scripts/getver.sh: avoid use of git rev-list --count
authorJonas Gorski <jonas.gorski@gmail.com>
Sat, 9 Jul 2016 13:01:58 +0000 (15:01 +0200)
committerJonas Gorski <jonas.gorski@gmail.com>
Sat, 9 Jul 2016 13:08:46 +0000 (15:08 +0200)
This is not a valid option in older git version, used in e.g. RHEL6.

Reported-by: Steven Haigh <netwiz@crc.id.au>
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
scripts/getver.sh

index 4c8fab079c14aa3f1669865f892b51468e642f78..fa2e67692592fb14a267979fa05f99c23f0c81cf 100755 (executable)
@@ -19,13 +19,13 @@ try_git() {
        case "$GET_REV" in
        r*)
                GET_REV="$(echo $GET_REV | tr -d 'r')"
-               BASE_REV="$(git rev-list reboot..HEAD --count)"
+               BASE_REV="$(git rev-list reboot..HEAD | wc -l)"
                REV="$(git rev-parse HEAD~$((BASE_REV - GET_REV)))"
                ;;
        *)
                UPSTREAM_BASE="$(git merge-base $GET_REV origin/master)"
-               UPSTREAM_REV="$(git rev-list reboot..$UPSTREAM_BASE --count)"
-               REV="$(git rev-list reboot..$GET_REV --count)"
+               UPSTREAM_REV="$(git rev-list reboot..$UPSTREAM_BASE | wc -l)"
+               REV="$(git rev-list reboot..$GET_REV | wc -l)"
                if [ -n "$REV" -a -n "$UPSTREAM_REV" -a "$REV" -gt "$UPSTREAM_REV" ]; then
                        REV="r${UPSTREAM_REV}+$((REV - UPSTREAM_REV))"
                else