From: Konstantin Dmitriev Date: Fri, 24 Jul 2009 15:36:57 +0000 (+0700) Subject: Detect path to .git dir automatically. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=800a4e11123a4f0248eb37f7a79fd6a9b4b98c1c;p=synfig.git Detect path to .git dir automatically. --- diff --git a/synfig-core/trunk/build_tools/autorevision.sh b/synfig-core/trunk/build_tools/autorevision.sh index b635911..c7a1919 100644 --- a/synfig-core/trunk/build_tools/autorevision.sh +++ b/synfig-core/trunk/build_tools/autorevision.sh @@ -25,7 +25,7 @@ get_git_id(){ BRANCH=${BRANCH#*/} fi export REVISION=`git show --pretty=format:%ci HEAD | head -c 10 | tr -d '-'` - export COMPARE="$1/.git/" + export COMPARE=`git rev-parse --git-dir` # The extra * at the end is for Modified #REVISION="$REVISION"`cd "$1"; [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"` } @@ -58,8 +58,8 @@ fi # Extract the revision from SVN/git/etc -if [ -e "$1/../../.git/refs/remotes/origin" ] ; then - get_git_id "$1/../.." +if git rev-parse --git-dir > /dev/null 2>&1 ; then + get_git_id "." elif [ -d "$1/.git/svn" ] ; then get_git_svn_id "$1" elif [ -d "$1/../.git/svn" ] ; then diff --git a/synfig-studio/trunk/build_tools/autorevision.sh b/synfig-studio/trunk/build_tools/autorevision.sh index 605f242..de4a5b6 100644 --- a/synfig-studio/trunk/build_tools/autorevision.sh +++ b/synfig-studio/trunk/build_tools/autorevision.sh @@ -25,7 +25,7 @@ get_git_id(){ BRANCH=${BRANCH#*/} fi export REVISION=`git show --pretty=format:%ci HEAD | head -c 10 | tr -d '-'` - export COMPARE="$1/.git/" + export COMPARE=`git rev-parse --git-dir` # The extra * at the end is for Modified #REVISION="$REVISION"`cd "$1"; [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"` } @@ -58,8 +58,8 @@ fi # Extract the revision from SVN/git/etc -if [ -e "$1/../../.git/refs/remotes/origin" ] ; then - get_git_id "$1/../.." +if git rev-parse --git-dir > /dev/null 2>&1 ; then + get_git_id "." elif [ -d "$1/.git/svn" ] ; then get_git_svn_id "$1" elif [ -d "$1/../.git/svn" ] ; then