Patch for version string for git users

Jeff Kletsky gnucash at allycomm.com
Tue Mar 2 18:17:13 EST 2010


If you're a git user, the splash screen and about screen include the 
full hash of the commit object.
It's a little unwieldy. This patch (also on the bug) changes
1a2528c8ca1d43e8e9e21b0661f844d2b496f47d
to either (the git-standard short hash)
1a2528c
or
1a2528c+
depending on if you have uncommitted changes in your working directory

https://bugzilla.gnome.org/show_bug.cgi?id=611645

$ git diff origin/master
diff --git a/util/gnc-svnversion b/util/gnc-svnversion
index d70c22f..17085ac 100755
--- a/util/gnc-svnversion
+++ b/util/gnc-svnversion
@@ -45,9 +45,11 @@ fi
  # Maybe it's git?
  if test -d "${real_srcdir}"/.git
  then
-  githead=`git --git-dir "${real_srcdir}"/.git rev-parse HEAD 2>/dev/null`
+  githead=`git --git-dir "${real_srcdir}"/.git log -1 --pretty=%h HEAD
2>/dev/null`  # short hash only
    if test $? = 0 ; then
-    echo $githead
+    echo -n $githead
+    git diff HEAD 2>&1>  /dev/null&&  echo -n "+"  # Add a "+" to the hash if
there are unstaged changes
+    echo
      exit 0
    else
      exit 1




More information about the gnucash-devel mailing list