From ddd0cb21fa223b7c410805868380301b31714812 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 19 Apr 2011 11:36:17 +0200 Subject: Be a bit more fail-safe in "build-aux/git-version-gen". The existence of a ".git" directory is not a sufficient condition to be sure we are in a Git repository. Only overwrite the version information file if `git describe` returns a non-empty string. Signed-off-by: Lukas Fleischer --- build-aux/git-version-gen | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'build-aux/git-version-gen') diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen index 2cc88fc..331faef 100755 --- a/build-aux/git-version-gen +++ b/build-aux/git-version-gen @@ -10,8 +10,9 @@ VERFILE="$1" if [ -d '.git' ] then - VERSION=`git describe --abbrev=4 --match='v[0-9]*' --dirty | sed 's/^v//'` - echo -n "$VERSION" > "$VERFILE" + VERSION=`git describe --abbrev=4 --match='v[0-9]*' --dirty 2>/dev/null` + VERSION=`echo "$VERSION" | sed 's/^v//'` + [ -n "$VERSION" ] && echo -n "$VERSION" > "$VERFILE" fi if [ -f "$VERFILE" ] -- cgit v1.2.3-70-g09d2