version.sh: fix git rev. generation (.git is not always a directory)

It appears git submodule handling recently changed, changing the .git
directory to a regular file containing submodule specific information.
This means that version.sh would generate "#define VERSION "git-UNKNOWN""
if the checkout is a submodule, because it explicitly checks for a .git
directory using test -d. Change it to -e so that this case is handled
correctly.
This commit is contained in:
wm4 2013-02-06 21:23:35 +01:00
parent 630a2b195a
commit 314a07e787
1 changed files with 1 additions and 1 deletions

View File

@ -7,7 +7,7 @@ test "$1" && extra="-$1"
# Extract revision number from file used by daily tarball snapshots # Extract revision number from file used by daily tarball snapshots
# or from "git describe" output # or from "git describe" output
git_revision=$(cat snapshot_version 2> /dev/null) git_revision=$(cat snapshot_version 2> /dev/null)
test $git_revision || test ! -d .git || git_revision=`git rev-parse --short HEAD` test $git_revision || test ! -e .git || git_revision=`git rev-parse --short HEAD`
git_revision=$(expr "$git_revision" : v*'\(.*\)') git_revision=$(expr "$git_revision" : v*'\(.*\)')
test $git_revision || git_revision=UNKNOWN test $git_revision || git_revision=UNKNOWN