summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2016-07-14 13:30:54 +0200
committerFelix Fietkau <nbd@nbd.name>2016-07-14 13:37:58 +0200
commit7ed215437c784eb466302a5c01a4ee2fff9eac2d (patch)
treec90ee581c1fe7ba633427d0bcad20006023db893
parent55761205ef8ae892e88c6201252b3f9ebf0f35fd (diff)
downloadmtk-20170518-7ed215437c784eb466302a5c01a4ee2fff9eac2d.zip
mtk-20170518-7ed215437c784eb466302a5c01a4ee2fff9eac2d.tar.gz
mtk-20170518-7ed215437c784eb466302a5c01a4ee2fff9eac2d.tar.bz2
scripts/getver.sh: stop relying on the reboot tag
It may not be present when cloning a staging tree or another fork Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rwxr-xr-xscripts/getver.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/getver.sh b/scripts/getver.sh
index 46eee9a..a65a6af 100755
--- a/scripts/getver.sh
+++ b/scripts/getver.sh
@@ -12,6 +12,7 @@ try_version() {
}
try_git() {
+ REBOOT=ee53a240ac902dc83209008a2671e7fdcf55957a
git rev-parse --git-dir >/dev/null 2>&1 || return 1
[ -n "$GET_REV" ] || GET_REV="HEAD"
@@ -19,18 +20,18 @@ try_git() {
case "$GET_REV" in
r*)
GET_REV="$(echo $GET_REV | tr -d 'r')"
- BASE_REV="$(git rev-list reboot..HEAD | wc -l | awk '{print $1}')"
+ BASE_REV="$(git rev-list ${REBOOT}..HEAD | wc -l | awk '{print $1}')"
REV="$(git rev-parse HEAD~$((BASE_REV - GET_REV)))"
;;
*)
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)"
- REV="$(git rev-list reboot..$GET_REV | wc -l | awk '{print $1}')"
+ REV="$(git rev-list ${REBOOT}..$GET_REV | wc -l | awk '{print $1}')"
if [ -n "$ORIGIN" ]; then
UPSTREAM_BASE="$(git merge-base $GET_REV $ORIGIN)"
- UPSTREAM_REV="$(git rev-list reboot..$UPSTREAM_BASE | wc -l | awk '{print $1}')"
+ UPSTREAM_REV="$(git rev-list ${REBOOT}..$UPSTREAM_BASE | wc -l | awk '{print $1}')"
else
UPSTREAM_REV=$REV
fi