瀏覽代碼

scripts/getver.sh: fix older git versions from printing stuff to stdout

Older git versions seem output the original argument to stdout if there
is no upstream, presumably because they try to do things with it
internally. This can be prevented by passing --verify to it, which
should be safe on newer git versions.

Signed-off-by: Jonas Gorski <[email protected]>
Jonas Gorski 9 年之前
父節點
當前提交
efdd3bf5fb
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      scripts/getver.sh

+ 2 - 2
scripts/getver.sh

@@ -25,8 +25,8 @@ try_git() {
 		;;
 	*)
 		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)"
+		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)"
 		REV="$(git rev-list ${REBOOT}..$GET_REV | wc -l | awk '{print $1}')"
 
 		if [ -n "$ORIGIN" ]; then