Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-core / trunk / build_tools / autorevision.sh
index b635911..c8f4cf2 100644 (file)
@@ -22,10 +22,10 @@ get_git_id(){
                BRANCH='master'
        else
                BRANCH=`echo $BRANCH | cut -d ' ' -f 1`
-               BRANCH=${BRANCH#*/}
+               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
@@ -103,5 +103,5 @@ fi
 
 # Output the header
 if [ x != "x$DEVEL_VERSION" ] ; then
-       printf "#define DEVEL_VERSION \"$DEVEL_VERSION\"\n" >> "$HEADER"
+       printf "#define DEVEL_VERSION \"$DEVEL_VERSION\"\n" > "$HEADER"
 fi