From: Jonas Gorski Date: Sat, 25 Jun 2016 12:23:30 +0000 (+0200) Subject: scripts/getver.sh: improve revision output X-Git-Tag: v17.01.0-rc1~2122 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=15b88df87f28faf4b37c8490c8e3af3fe1e4c0cb;p=openwrt%2Fopenwrt.git scripts/getver.sh: improve revision output Change the revision output to r+ so it is easier to get the base revision (and see if there are local commits). Example: $ ./scripts/getver.sh r794+3 $ Signed-off-by: Jonas Gorski --- diff --git a/scripts/getver.sh b/scripts/getver.sh index a60b91ede1..4c8fab079c 100755 --- a/scripts/getver.sh +++ b/scripts/getver.sh @@ -23,9 +23,14 @@ try_git() { 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)" - REV="${REV:+r$REV}" + if [ -n "$REV" -a -n "$UPSTREAM_REV" -a "$REV" -gt "$UPSTREAM_REV" ]; then + REV="r${UPSTREAM_REV}+$((REV - UPSTREAM_REV))" + else + REV="${REV:+r$REV}" + fi ;; esac