Just to clarify my problem:

> git --version
git version 1.6.0.2
> git --git-dir ./.git log -1 --pretty=%h HEAD >result
fatal: invalid --pretty format: %h
> cat result
>

So git version 1.6.0.2 requires --pretty=format: to interpret "%h". Attached 
is an improved version of my patch - removed trailing spaces and applied my 
substitution real_gitdir also on the outcommented line.
 
Frank


From 7b924629e06d225af9109a282da9715f0f765d80 Mon Sep 17 00:00:00 2001
From: Frank H. Ellenberger <[email protected]>
Date: Thu, 8 Apr 2010 23:18:09 +0200
Subject: [PATCH] Re: r18880 - Bug #611645 gnc-svnversion returns "too long" a string for git users, patch by Jeff Kletsky

Insert missing "format:" - otherwise it didn't build for me.
Additional simplifying git expressions.
---
 util/gnc-svnversion |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/util/gnc-svnversion b/util/gnc-svnversion
index 980cf2e..dfaae6b 100755
--- a/util/gnc-svnversion
+++ b/util/gnc-svnversion
@@ -43,16 +43,17 @@ fi
 # If we get here then this is NOT an svn checkout.
 
 # Maybe it's git?
-if test -d "${real_srcdir}"/.git
+real_gitdir="${real_srcdir}"/.git
+if test -d "${real_gitdir}"
 then
-  githead=`git --git-dir "${real_srcdir}"/.git log -1 --pretty=%h HEAD 2>/dev/null`  # short hash only
+  githead=`git --git-dir "${real_gitdir}" log -1 --pretty=format:"%h" HEAD 2>/dev/null`  # short hash only
   if test $? = 0 ; then
     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 "+"  
+    # [ $(git --git-dir "${real_gitdir}" 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 "+"  
+    [ $(git --git-dir "${real_gitdir}" ls-files -dkmo --exclude-standard 2>/dev/null | wc -l) -gt 0 ] && echo -n "+"
     echo
     exit 0
   else
-- 
1.6.0.2

_______________________________________________
gnucash-devel mailing list
[email protected]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to