scripts/getver.sh: fix revision number on BSD/MacOS
authorFelix Fietkau <nbd@nbd.name>
Sat, 9 Jul 2016 18:00:50 +0000 (20:00 +0200)
committerFelix Fietkau <nbd@nbd.name>
Sat, 9 Jul 2016 18:02:21 +0000 (20:02 +0200)
Strip leading whitespace from wc -l output

Signed-off-by: Felix Fietkau <nbd@nbd.name>
scripts/getver.sh

index fa2e67692592fb14a267979fa05f99c23f0c81cf..5d8788f20200906fa8c0326d2e7e3242b3b1c691 100755 (executable)
@@ -24,8 +24,8 @@ try_git() {
                ;;
        *)
                UPSTREAM_BASE="$(git merge-base $GET_REV origin/master)"
-               UPSTREAM_REV="$(git rev-list reboot..$UPSTREAM_BASE | wc -l)"
-               REV="$(git rev-list reboot..$GET_REV | wc -l)"
+               UPSTREAM_REV="$(git rev-list reboot..$UPSTREAM_BASE | wc -l | awk '{print $1}')"
+               REV="$(git rev-list reboot..$GET_REV | wc -l | awk '{print $1}')"
                if [ -n "$REV" -a -n "$UPSTREAM_REV" -a "$REV" -gt "$UPSTREAM_REV" ]; then
                        REV="r${UPSTREAM_REV}+$((REV - UPSTREAM_REV))"
                else