Subject: gitk: bug comparing marked commits

From: Pat Thoyts <[email-masked]>
Date: 17 Apr 2009 23:52:02 +0100

I just pulled from gitk and noticed the new 'mark commit' menu
items. While testing to see what they do I get a Tk error when
comparing two dissimilar patches on the same branch which is caused by
a missing parameter to appendwithlinks as fixed by the following
patch.

I also get an error comparing two identical patches (one on my working
branch and one that has been applied to master). For this when marking
the master (476afad) and then calling the 'compare with marked commit'
menu item against my original (f58f01e5) I get:

fatal: bad object 0000000000000000000000000000000000000000
fatal: bad object 0000000000000000000000000000000000000000
    while executing
"exec git diff-tree -p --root $id | git patch-id"
    (procedure "getpatchid" line 5)
    invoked from within
"getpatchid $a"
    (procedure "do_cmp_commits" line 16)
    invoked from within
"do_cmp_commits $markedid $rowmenuid"
    (procedure "compare_commits" line 7)
    invoked from within

although the text widget contains text that says:

Commit 478afad6  gitk: Avoid crash if closed while reading references
 is the same patch as
       f58f01e5  gitk: avoid crash if closed while reading references

The fix for problem 1 is:

diff --git a/gitk b/gitk
index dca1741..d9f4828 100755
--- a/gitk
+++ b/gitk
@@ -8175,7 +8175,7 @@ proc do_cmp_commits {a b} {
 		appendwithlinks [mc "Commit %s  %s\n" $shorta $heada] {}
 		appendwithlinks [mc " differs from\n"] {}
 		appendwithlinks [mc "       %s  %s\n" $shortb $headb] {}
-		appendwithlinks [mc "- stopping\n"]
+		appendwithlinks [mc "- stopping\n"] {}
 		break
 	    }
 	}