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

gitk changing line color for no reason after merge

From
PRPavel Roskin <proski@gnu.org>
Date
Feb 2, 2006, 17:21 UTC
Message-ID
<1138900897.28967.18.camel@dv>
Hello, Paul!

I have noticed that gitk changes the line color at a commit following a merge (i.e. a commit with many parents). I made this screenshot to demonstrate the problem:

http://red-bean.com/proski/gitk/gitk.png

If you follow the leftmost line, you'll see how green becomes red, gray becomes brown and red becomes blue.

I think it would be much better if line colors only change at non-trivial nodes, i.e. those with more than one child or parent.

The fix is trivial:
diff --git a/gitk b/gitk
index f12b3ce..14ff570 100755
--- a/gitk
+++ b/gitk
@@ -770,7 +770,7 @@ proc assigncolor {id} {
 
     if [info exists colormap($id)] return
     set ncolors [llength $colors]
-    if {$nparents($id) <= 1 && $nchildren($id) == 1} {
+    if {$nchildren($id) == 1} {
 	set child [lindex $children($id) 0]
 	if {[info exists colormap($child)]
 	    && $nparents($child) == 1} {


I checked the history of gitk and could trace this code back to the
first version of gitk in the git repository.  Maybe it was intended this
way, but I think it would be better to fix it.
-- 
Regards,
Pavel Roskin
Next: Pavel Roskin
Message 1 of 8 in “gitk changing line color for no reason after merge”
  1. Pavel RoskinFeb 2, 2006
  2. Pavel RoskinFeb 7, 2006
  3. Paul MackerrasFeb 7, 2006
  4. Pavel RoskinFeb 8, 2006
  5. Junio C HamanoFeb 7, 2006
  6. Pavel RoskinFeb 8, 2006
  7. Paul MackerrasFeb 8, 2006
  8. Pavel RoskinFeb 8, 2006

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.