Don't require .git before running git-describe

When calculating the version, we don't need to test for the presence of
.git before running `git describe`. This lets us work properly in a
detached work tree if GIT_DIR is set.
This commit is contained in:
Kevin Ballard 2014-10-27 15:46:22 -07:00
parent f03d90e9de
commit ec5f3d0cc8

View file

@ -12,10 +12,7 @@ DEF_VER=unknown
if test -f version if test -f version
then then
VN=$(cat version) || VN="$DEF_VER" VN=$(cat version) || VN="$DEF_VER"
elif test -d .git -o -f .git && type git >/dev/null elif ! VN=$(git describe --always --dirty 2>/dev/null); then
then
VN=$(git describe --always --dirty 2>/dev/null)
else
VN="$DEF_VER" VN="$DEF_VER"
fi fi