Honor GIT_DIR setting when determining version

If GIT_DIR is not set, fall back to top_srcdir/.git

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Hans Ulrich Niedermann 2008-01-25 12:59:17 +01:00 committed by Julien Danjou
parent e1d3b007a7
commit 6dd1c20816
2 changed files with 13 additions and 3 deletions

View file

@ -7,8 +7,13 @@ srcdir=`dirname "$0"`
# sed program
SED=${SED-sed}
# If GIT_DIR is set, use it. If not, try ".git".
if test -n "$GIT_DIR"; then :;
else GIT_DIR=".git"; export GIT_DIR
fi
# Check whether the version needs to be updated from VCS/version-stamp
if [ -d ".git" ] && [ -d "autom4te.cache" ]; then
if [ -d "$GIT_DIR" ] && [ -d "autom4te.cache" ]; then
git_describe=`./build-utils/package-version . version-stamp`
for f in autom4te.cache/output.*; do
[ -f "$f" ] || continue

View file

@ -12,10 +12,15 @@ test -d "$top_srcdir" || { \
}
version_stamp="${2-version-stamp}"
# If GIT_DIR is set, use it. If not, try top_srcdir/.git.
if test -n "$GIT_DIR"; then :;
else GIT_DIR="$top_srcdir/.git"; export GIT_DIR
fi
if test -f "$top_srcdir/$version_stamp"; then # dist source tree
cat "$top_srcdir/$version_stamp" | ${TR-tr} -d '\012'
elif test -d "$top_srcdir/.git"; then # git source tree
git_describe=`${GIT-git} --git-dir="$top_srcdir/.git" describe 2>/dev/null || echo devel`
elif test -d "$GIT_DIR"; then # git source tree
git_describe=`${GIT-git} describe 2>/dev/null || echo devel`
echo "$git_describe" | ${SED-sed} -e 's/^v//' -e 's/-/./g' | ${TR-tr} -d '\012'
else # ???
echo "devel" | ${TR-tr} -d '\012'