scripts/getver.sh: fix older git versions from printing stuff to stdout
authorJonas Gorski <jonas.gorski@gmail.com>
Sat, 16 Jul 2016 14:57:05 +0000 (16:57 +0200)
committerJonas Gorski <jonas.gorski@gmail.com>
Sat, 16 Jul 2016 18:50:56 +0000 (20:50 +0200)
Older git versions seem output the original argument to stdout if there
is no upstream, presumably because they try to do things with it
internally. This can be prevented by passing --verify to it, which
should be safe on newer git versions.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
scripts/getver.sh

index a65a6af22847f45e3188baeb527590b8a7cb58be..e718485852d427300892f412dba320a494a1c23f 100755 (executable)
@@ -25,8 +25,8 @@ try_git() {
                ;;
        *)
                BRANCH="$(git rev-parse --abbrev-ref HEAD)"
-               ORIGIN="$(git rev-parse --symbolic-full-name ${BRANCH}@{u} 2>/dev/null)"
-               [ -n "$ORIGIN" ] || ORIGIN="$(git rev-parse --symbolic-full-name master@{u} 2>/dev/null)"
+               ORIGIN="$(git rev-parse --verify --symbolic-full-name ${BRANCH}@{u} 2>/dev/null)"
+               [ -n "$ORIGIN" ] || ORIGIN="$(git rev-parse --verify --symbolic-full-name master@{u} 2>/dev/null)"
                REV="$(git rev-list ${REBOOT}..$GET_REV | wc -l | awk '{print $1}')"
 
                if [ -n "$ORIGIN" ]; then