* detect git repostories and branches
authorWilfried Göesgens <willi@citadel.org>
Sat, 12 Jun 2010 21:41:22 +0000 (21:41 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sat, 12 Jun 2010 21:41:22 +0000 (21:41 +0000)
citadel/scripts/mk_svn_revision.sh

index b94a7b8cef6afd520c84acfff17848318c66fbdc..35ad0dc94af1ed068e4a8206b8520a5645e2f6f4 100755 (executable)
@@ -20,16 +20,25 @@ if test -d $SRC_DIR/.svn  ; then
        if test -x $SVNVERSION  ; then
                echo "have svnversion at $SVNVERSION"
                BUILD=`svnversion -n .`
-               echo "This code base revision $BUILD"
+               echo "This code base svn-revision: $BUILD"
                CAN_BUILD_SVN_REVISION="yes"
        fi
+else 
+    if git status> /dev/null 2>&1; then 
+       echo "have Git repository."
+       TAG=`git rev-parse HEAD`
+       BRANCH="`git show-branch |sed 's;\[\(.*\)\].*;\1;'`"
+       BUILD="GIT: $BRANCH : $TAG"
+       echo "This code base git-revision: $BUILD"
+       CAN_BUILD_SVN_REVISION="yes"
+    fi
 fi
 
 if [ "$CAN_BUILD_SVN_REVISION" = "yes" ] ; then
 
 cat <<EOF > $C_FILE
 /*
- * Subversion revision functions
+ * Subversion / GIT revision functions
  *
  * Autogenerated at make/release time
  *
@@ -48,7 +57,7 @@ elif test ! -f $C_FILE  ; then
 
 cat <<EOF > $C_FILE
 /*
- * Subversion revision functions
+ * Subversion / GIT revision functions
  *
  * Autogenerated at make time
  *