git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitk: fix for empty line after Comments

From
PRPavel Roskin <proski@gnu.org>
Date
Nov 2, 2005, 20:42 UTC
Message-ID
<1130964168.23026.2.camel@dv>

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 <proski@gnu.org>
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
Message 1 of 1 in “gitk: fix for empty line after Comments”
  1. gitk: fix for empty line after CommentsPavel Roskin, Nov 2, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.