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

Re: [PATCH 4/3] bisect: use a detached HEAD to bisect

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
May 24, 2008, 16:14 UTC
Message-ID
<alpine.LFD.1.10.0805240842360.3081@woody.linux-foundation.org>
In-Reply-To
<18487.62245.59892.442935@cargo.ozlabs.ibm.com>
On Sat, 24 May 2008, Paul Mackerras wrote:
Show 6 quoted lines
> 
> I could make it show "HEAD" in a green box for a detached head easily
> enough.  That could be ambiguous if you had a branch called HEAD, I
> suppose, but having a branch called HEAD would be deeply confusing
> anyway. :)  Do you have any alternative suggestion for how to display
> a detached head?

Well, it would be really nice if the "active commit" was always visible some way.

Of course, _usually_ it's just the top commit, and it's obvious that way which one is the checked-out one, but if you do "gitk --all" or just generally have multiple branches, right now it's hard to see what commit is the checked-out one, regardless of whether it's detached or not.

I think "HEAD" in a green box would solve that too, but on the other hand, we have a *lot* of boxes already. For people who mainly just track another repo, you already have one box saying "master", and another one saying "remotes/origin/master", and adding yet *another* box saying HEAD that just points to the same commit will work, but do we really want that?

I actually like the red circle for "Local uncommitted changes". Maybe we can use a similar visual clue for "currently checked out". You already picked green for the "added to the index" case, so we have the three primary RGB colors already used, but we could make it just be a deep yellow.

Of course, maybe people hate lots of colos already, and something more akin to the text background thing that we use for the selected commit would be better.

I dunno. There's so many options.
Here's a "make it yellow" patch.
		Linus
----
 gitk-git/gitk |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/gitk-git/gitk b/gitk-git/gitk
index 9ab6dba..94ca826 100644
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -4841,7 +4841,8 @@ proc drawcmittext {id row col} {
     global cmitlisted commitinfo rowidlist parentlist
     global rowtextx idpos idtags idheads idotherrefs
     global linehtag linentag linedtag selectedline
-    global canvxmax boldrows boldnamerows fgcolor nullid nullid2
+    global canvxmax boldrows boldnamerows fgcolor
+    global HEAD nullid nullid2
 
     # listed is 0 for boundary, 1 for normal, 2 for negative, 3 for left, 4 for right
     set listed $cmitlisted($curview,$id)
@@ -4849,6 +4850,8 @@ proc drawcmittext {id row col} {
 	set ofill red
     } elseif {$id eq $nullid2} {
 	set ofill green
+    } elseif {$id eq $HEAD} {
+	set ofill yellow
     } else {
 	set ofill [expr {$listed != 0 ? $listed == 2 ? "gray" : "blue" : "white"}]
     }
@@ -9886,6 +9889,8 @@ set viewperm(0) 0
 set viewargs(0) {}
 set viewargscmd(0) {}
 
+set HEAD [exec git rev-parse HEAD]
+
 set numcommits 0
 set loginstance 0
 set cmdlineok 0
Previous: Paul MackerrasNext: Jeff King
Message 7 of 10 in “bisect: use a detached HEAD to bisect”
  1. 4/3 bisect: use a detached HEAD to bisectChristian Couder, May 22, 2008
  2. Junio C HamanoMay 23, 2008
  3. Christian CouderMay 23, 2008
  4. Jon LoeligerMay 23, 2008
  5. Linus TorvaldsMay 23, 2008
  6. Paul MackerrasMay 24, 2008
  7. Linus TorvaldsMay 24, 2008
  8. Jeff KingMay 25, 2008
  9. Paul MackerrasMay 26, 2008
  10. Junio C HamanoMay 26, 2008

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.