scripts: getver.sh: fix version based on stable branch
authorBaptiste Jonglez <git@bitsofnetworks.org>
Thu, 3 Sep 2020 21:19:22 +0000 (23:19 +0200)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Wed, 7 Oct 2020 21:15:10 +0000 (23:15 +0200)
When building from a local branch based off the "openwrt-18.06" branch,
version computation is wrong, for instance:

    r6907+1154-7e15e21766

The number of local commits (1154 in this case) is wrong because it is
computed against master.  As a result, it wrongly counts *all* commits
since the beginning of the openwrt-18.06 branch as local commits.

The fix is to compare to the openwrt-18.06 branch instead, which gives the
expected result such as:

    r8060+1-1238a22316

Signed-off-by: Baptiste Jonglez <git@bitsofnetworks.org>
[shorten commit title]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
scripts/getver.sh

index 9175f411db8345ab420fdb1edcaf0d20f858f12f..dbd32923439a9d5549d84cd29c9bb0c757f6aeea 100755 (executable)
@@ -26,7 +26,7 @@ try_git() {
        *)
                BRANCH="$(git rev-parse --abbrev-ref HEAD)"
                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)"
+               [ -n "$ORIGIN" ] || ORIGIN="$(git rev-parse --verify --symbolic-full-name openwrt-18.06@{u} 2>/dev/null)"
                REV="$(git rev-list ${REBOOT}..$GET_REV | wc -l | awk '{print $1}')"
 
                if [ -n "$ORIGIN" ]; then