blob: 32f85d4bdf54807351d5c6b567e5d8b70cb27663 [file] [log] [blame]
http://bugs.gentoo.org/355045
[PATCH] git-version-gen: skip "-dirty" check when appropriate
* build-aux/git-version-gen: Don't run any git commands
when the version comes from .tarball-version. Prior to this,
we would run git update-index --refresh even from a just-unpacked
tarball directory, and that could affect a .git/ directory in a
parent of the build directory. Reported by Mike Frysinger.
diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
index 68c7d64..686f703 100755
--- a/build-aux/git-version-gen
+++ b/build-aux/git-version-gen
@@ -124,13 +124,16 @@
# Change the first '-' to a '.', so version-comparing tools work properly.
# Remove the "g" in git describe's output string, to save a byte.
v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;
+ v_from_git=1
else
v=UNKNOWN
+ v_from_git=
fi
v=`echo "$v" |sed 's/^v//'`
# Don't declare a version "dirty" merely because a time stamp has changed.
+if test -n "$v_from_git"; then
git update-index --refresh > /dev/null 2>&1
dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty=
@@ -142,6 +145,7 @@
*) v="$v-dirty" ;;
esac ;;
esac
+fi
# Omit the trailing newline, so that m4_esyscmd can use the result directly.
echo "$v" | tr -d "$nl"