Skip to contentSkip to conversation

gitk - show newly created files

PATCH New Alecs King 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore

Alecs King

author
#0 lore raw

PATCH 1/1 gitk - show newly created files

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?

gitk +3 -3
index f12b3ce..688ee12 100755
@@ -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
     }
 }
 
Signature · 1 line
Alecs King