diff --git a/scripts/getver.sh b/scripts/getver.sh
index ecf048f4c1c88b308295e5d9d79e34bc2f70a12e..9175f411db8345ab420fdb1edcaf0d20f858f12f 100755
--- a/scripts/getver.sh
+++ b/scripts/getver.sh
@@ -40,7 +40,8 @@ try_git() {
 			REV="${UPSTREAM_REV}+$((REV - UPSTREAM_REV))"
 		fi
 
-		REV="${REV:+r$REV-$(git log --format="%h" -1)}"
+		REV="${REV:+r$REV-$(git log -n 1 --format="%h" $UPSTREAM_BASE)}"
+
 		;;
 	esac