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

[PATCH v3] gitk: Teach gitk to respect log.showroot

From
MKMarcus Karlsson <mk@acc.umu.se>
Date
Oct 4, 2011, 20:08 UTC
Message-ID
<20111004200813.GA16596@kennedy.acc.umu.se>

In early days, all projects managed by git (except for git itself) had the product of a fairly mature development history in their first commit, and it was deemed unnecessary clutter to show additions of these thousands of paths as a patch.

"git log" learned to show the patch for the initial commit without requiring --root command line option at 0f03ca9 (config option log.showroot to show the diff of root commits, 2006-11-23).

Teach gitk to respect log.showroot.
Signed-off-by: Marcus Karlsson <mk@acc.umu.se>
---
Improved the commit message after suggestion from Zbigniew
Jedrzejewski-Szmek.
 gitk-git/gitk |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/gitk-git/gitk b/gitk-git/gitk
index 4cde0c4..40ea73f 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -7402,7 +7402,7 @@ proc addtocflist {ids} {
 }
 
 proc diffcmd {ids flags} {
-    global nullid nullid2
+    global log_showroot nullid nullid2
 
     set i [lsearch -exact $ids $nullid]
     set j [lsearch -exact $ids $nullid2]
@@ -7436,7 +7436,11 @@ proc diffcmd {ids flags} {
 	    lappend cmd HEAD
 	}
     } else {
-	set cmd [concat | git diff-tree -r $flags $ids]
+	set cmd [concat | git diff-tree -r]
+	if {$log_showroot eq true} {
+	    set cmd [concat $cmd --root]
+	}
+	set cmd [concat $cmd $flags $ids]
     }
     return $cmd
 }
@@ -11403,6 +11407,11 @@ catch {
     }
 }
 
+set log_showroot true
+catch {
+    set log_showroot [exec git config --get log.showroot]
+}
+
 if {[tk windowingsystem] eq "aqua"} {
     set mainfont {{Lucida Grande} 9}
     set textfont {Monaco 9}
-- 
1.7.7
Next: Paul Mackerras
Message 1 of 5 in “gitk: Teach gitk to respect log.showroot”
  1. gitk: Teach gitk to respect log.showrootMarcus Karlsson, Oct 4, 2011
  2. Paul MackerrasOct 8, 2011
  3. Marcus KarlssonOct 12, 2011
  4. Paul MackerrasMar 18, 2012
  5. Zbigniew Jędrzejewski-SzmekMar 19, 2012

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.