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

Re: [PATCH] rev-parse: include HEAD in --all output

From
Max Kirillov <max@max630.net>
Date
Aug 31, 2014, 21:36 UTC
Message-ID
<20140831213606.GB6385@wheezy.local>
In-Reply-To
<20140831153054.GD17449@peff.net>
On Sun, Aug 31, 2014 at 11:30:54AM -0400, Jeff King wrote:
Show 19 quoted lines
> On Sun, Aug 31, 2014 at 01:24:48AM +0300, Max Kirillov wrote:
> 
>> for_each_ref() does not include it itself, and without
>> the hash the detached HEAD may be missed by some
>> frontends (like gitk).
>> 
>> Add test which verifies the head is returned
>> 
>> Update test t6018-rev-list-glob.sh which relied on exact
>> list of returned hashes.
> 
> I think the missing bit of the justification here is that
> "--all" _does_ include HEAD in other contexts (like in
> git-log), and rev-parse should probably match it.
> 
> This is probably the right thing to do. It's possible that
> some caller of rev-parse really depends on "--all" meaning
> "just the refs", but I kind of doubt it. Being in sync
> with the revision.c parser seems saner.

Actually, yes, this is a bit incompatible change, and while I'm pretty sure that rev-parse returning hashes should include detached HEAD, returning HEAD when it's called with something like "--symbolic" might be questioned. It could depend on the output mode (add HEAD only if printing hashes) but this kind of logic does not look good. So maybe some more opinions should be asked for.

btw, manpage for git-rev-parse says "Show all refs found in refs/.", should it also be changed?

-- 
Max
Previous: Jeff KingNext: Junio C Hamano
Message 6 of 8 in “[RFC] add detached HEAD to --all listing”
  1. Max KirillovAug 27, 2014
  2. Jeff KingAug 27, 2014
  3. Max KirillovAug 27, 2014
  4. rev-parse: include HEAD in --all outputMax Kirillov, Aug 30, 2014
  5. Jeff KingAug 31, 2014
  6. Max KirillovAug 31, 2014
  7. Junio C HamanoSep 2, 2014
  8. Max KirillovSep 3, 2014

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.