浏览代码

git-version-gen: Prevent multiple lines of output

Nikias Bassen 2 年之前
父节点
当前提交
a851716c84
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      git-version-gen

+ 2 - 1
git-version-gen

@@ -3,7 +3,7 @@ SRCDIR=`dirname $0`
 if test -n "$1"; then
   VER=$1
 else
-  if test -d "${SRCDIR}/.git" && test -x "`which git`" ; then
+  if test -r "${SRCDIR}/.git" && test -x "`which git`" ; then
     git update-index -q --refresh
     if ! VER=`git describe --tags --dirty 2>/dev/null`; then
       COMMIT=`git rev-parse --short HEAD`
@@ -16,4 +16,5 @@ else
     fi
   fi
 fi
+VER=`printf %s "$VER" | head -n1`
 printf %s "$VER"