From 104295375e266863e57d8d95bff668871ca0c340 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Fri, 25 Jan 2008 12:59:17 +0100 Subject: [PATCH] Honor GIT_DIR setting when determining version If GIT_DIR is not set, fall back to top_srcdir/.git --- autogen.sh | 7 ++++++- build-utils/package-version | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/autogen.sh b/autogen.sh index de5d14e..88f7b9b 100755 --- a/autogen.sh +++ b/autogen.sh @@ -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 diff --git a/build-utils/package-version b/build-utils/package-version index ee9bead..61a3018 100755 --- a/build-utils/package-version +++ b/build-utils/package-version @@ -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} 's/^v//;s/-/./;s/-g/-/' | ${TR-tr} -d '\012' else # ??? echo "devel" | ${TR-tr} -d '\012' -- 1.5.3.7