X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fbuild_tools%2Fautorevision.sh;h=c8f4cf2e4d3dc2a85946e9856cd1bc8e9fe27e6b;hb=3d0655b0728cc3b9d528375431f7b01a5d0b3d5b;hp=9e31cd1f54cb47efcb05de22c77eea32197094ef;hpb=f6235817a7a2b5a66539c494454daf2af04b2a4b;p=synfig.git diff --git a/synfig-core/trunk/build_tools/autorevision.sh b/synfig-core/trunk/build_tools/autorevision.sh index 9e31cd1..c8f4cf2 100644 --- a/synfig-core/trunk/build_tools/autorevision.sh +++ b/synfig-core/trunk/build_tools/autorevision.sh @@ -15,18 +15,17 @@ get_git_id(){ export SCM=git - export REVISION=`cd "$1"; git log --no-color -1 | head -n 1 | cut -f 2 -d ' '` - BRANCH=`cd "$1"; git branch -a --no-color --contains HEAD | sed -e s/\*\ // | sed -e s/\(no\ branch\)//` + export REVISION_ID=`cd "$1"; git log --no-color -1 | head -n 1 | cut -f 2 -d ' '` + export BRANCH="`cd "$1"; git branch -a --no-color --contains HEAD | sed -e s/\*\ // | sed -e s/\(no\ branch\)// | tr '\n' ' ' | tr -s ' ' | sed s/^' '//`" if ( echo $BRANCH | egrep origin/master > /dev/null ); then #give a priority to master branch BRANCH='master' else BRANCH=`echo $BRANCH | cut -d ' ' -f 1` - BRANCH=${BRANCH#*/} + BRANCH=${BRANCH##*/} fi - export DATE=`git-show --pretty=format:%ci HEAD | head -c 10` - DATE=${DATE:0:4}${DATE:5:2}${DATE:8:2} - export COMPARE="$1/.git/" + export REVISION=`git show --pretty=format:%ci HEAD | head -c 10 | tr -d '-'` + 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 "*"` } @@ -59,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 @@ -94,7 +93,7 @@ if [ x = "x$DEVEL_VERSION" ] ; then elif [ $SCM = git-svn ] ; then DEVEL_VERSION="SVN r$REVISION (via git)" elif [ $SCM = git ] ; then - DEVEL_VERSION="Development version: $DATE \\nBranch: ${BRANCH} \\nRevision ID: $REVISION" + DEVEL_VERSION="Revision: ${REVISION}\\\\nBranch: ${BRANCH}\\\\nRevision ID: ${REVISION_ID}" elif [ $SCM = manual ] ; then DEVEL_VERSION="$REVISION (manually configured)" fi @@ -104,5 +103,5 @@ fi # Output the header if [ x != "x$DEVEL_VERSION" ] ; then - echo "#define DEVEL_VERSION \"$DEVEL_VERSION\"" >> "$HEADER" + printf "#define DEVEL_VERSION \"$DEVEL_VERSION\"\n" > "$HEADER" fi