Subject: [PATCH] gitk: fix for empty line after Comments

From: Pavel Roskin <[email-masked]>
Date: Wed, 02 Nov 2005 15:42:48 -0500

git-diff-tree called with one tree-ish shows the commit ID, which should
be ignored by gitk.  getblobdiffs() and gettreediffline() recognize and
ignore commit ID now.

Also, the p variable that was used as the other argument git-diff-tree
is no longer used, so it's dropped in both places.

Signed-off-by: Pavel Roskin <[email-masked]>

diff --git a/gitk b/gitk
index a9d37d9..e935484 100755
--- a/gitk
+++ b/gitk
@@ -2805,7 +2805,6 @@ proc gettreediffs {ids} {
     set treepending $ids
     set treediff {}
     set id [lindex $ids 0]
-    set p [lindex $ids 1]
     if [catch {set gdtf [open "|git-diff-tree -r $id" r]}] return
     fconfigure $gdtf -blocking 0
     fileevent $gdtf readable [list gettreediffline $gdtf $ids]
@@ -2830,6 +2829,8 @@ proc gettreediffline {gdtf ids} {
 	    }
 	}
 	return
+    } elseif {$n == 40} {
+	return
     }
     set file [lindex $line 5]
     lappend treediff $file
@@ -2840,7 +2841,6 @@ proc getblobdiffs {ids} {
     global difffilestart nextupdate diffinhdr treediffs
 
     set id [lindex $ids 0]
-    set p [lindex $ids 1]
     set env(GIT_DIFF_OPTS) $diffopts
     set cmd [list | git-diff-tree -r -p -C $id]
     if {[catch {set bdf [open $cmd r]} err]} {
@@ -2934,7 +2934,7 @@ proc getblobdiffline {bdf ids} {
 	} elseif {$diffinhdr || $x == "\\"} {
 	    # e.g. "\ No newline at end of file"
 	    $ctext insert end "$line\n" filesep
-	} else {
+	} elseif {![regexp {^[0-9a-f]{40}$} $line]} {
 	    # Something else we don't recognize
 	    if {$curdifftag != "Comments"} {
 		$ctext insert end "\n"

-- 
Regards,
Pavel Roskin