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

[PATCH] gitk - show newly created files

From
Alecs King <alecsk@gmail.com>
Date
Dec 31, 2005, 08:14 UTC
Message-ID
<20051231081403.GA4547@localhost>
When specifying a filename as an argument to gitk, ie.
$ gitk apply.c
gitk does not show the diff when the file newly created.  

That 'newly created' commit is the last one gitk gets from 'git-rev-list' so gitk thinks it has no parent while it normally does (except that the commit itself is the root commit).

This patch is to (try to) fix this problem.
P.S, is it good if gitk also has a '--root' option like git-whatchanged?
Signed-off-by: Alecs King <alecsk@gmail.com>
diff --git a/gitk b/gitk
index f12b3ce..688ee12 100755
--- a/gitk
+++ b/gitk
@@ -2288,10 +2288,10 @@ proc selectline {l isnew} {
 
     $cflist delete 0 end
     $cflist insert end "Comments"
-    if {$nparents($id) == 1} {
-	startdiff $id
-    } elseif {$nparents($id) > 1} {
+    if {$nparents($id) > 1} {
 	mergediff $id
+    } else {
+        startdiff $id
     }
 }
 
-- 
Alecs King
Message 1 of 1 in “gitk - show newly created files”
  1. gitk - show newly created filesAlecs King, Dec 31, 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.