r18880 - gnucash/trunk/util - Bug #611645 gnc-svnversion returns "too long" a string for git users, patch by Jeff Kletsky

Geert Janssens gjanssens at code.gnucash.org
Tue Mar 9 13:28:04 EST 2010


Author: gjanssens
Date: 2010-03-09 13:28:04 -0500 (Tue, 09 Mar 2010)
New Revision: 18880
Trac: http://svn.gnucash.org/trac/changeset/18880

Modified:
   gnucash/trunk/util/gnc-svnversion
Log:
Bug #611645 gnc-svnversion returns "too long" a string for git users, patch by Jeff Kletsky

Modified: gnucash/trunk/util/gnc-svnversion
===================================================================
--- gnucash/trunk/util/gnc-svnversion	2010-03-09 12:17:12 UTC (rev 18879)
+++ gnucash/trunk/util/gnc-svnversion	2010-03-09 18:28:04 UTC (rev 18880)
@@ -45,9 +45,15 @@
 # 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
+    # Add a "+" to the hash if there deleted or modified files (not excluded by .gitignore and friends)
+    # "Ignores" untracked files
+    # [ $(git --git-dir "${real_srcdir}"/.git ls-files -dkm 2>/dev/null | wc -l) -gt 0 ] && echo -n "+"  
+    # Includes untracked files
+    [ $(git --git-dir "${real_srcdir}"/.git ls-files -dkmo --exclude-standard 2>/dev/null | wc -l) -gt 0 ] && echo -n "+"  
+    echo
     exit 0
   else
     exit 1



More information about the gnucash-changes mailing list