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

Re: [PATCH] rev-list-options.txt: update --all about detached HEAD

From
Jeff King <peff@peff.net>
Date
Feb 7, 2017, 19:42 UTC
Message-ID
<20170207194239.icyqawhja2losjul@sigill.intra.peff.net>
In-Reply-To
<20170207133850.14056-1-pclouds@gmail.com>
On Tue, Feb 07, 2017 at 08:38:49PM +0700, Nguyễn Thái Ngọc Duy wrote:
Show 8 quoted lines
> This is the document patch for f0298cf1c6 (revision walker: include a
> detached HEAD in --all - 2009-01-16)
> [...]
>  --all::
> -	Pretend as if all the refs in `refs/` are listed on the
> -	command line as '<commit>'.
> +	Pretend as if all the refs in `refs/` (and HEAD if detached)
> +	are listed on the command line as '<commit>'.

I think this is an improvement, but I'm not sure about the "if detached" bit. We always read HEAD, no matter what.

If you only care about reachability, then reading HEAD only has an impact if it is detached, since otherwise we know that we will grab the ref via refs/.

I'm not sure if it would matter for some other cases, though. For example, with "--source", do we report HEAD or the matching ref? It looks like the latter (because we read the refs first).

I suspect you could also construct a case with excludes like:
  $ git checkout foo
  $ git rev-list --exclude=refs/heads/foo --all
where it is relevant that we read HEAD separately from refs/heads/foo.
So I think just "and HEAD" is better, like:
  Pretend as if all the refs in `refs/`, along with `HEAD`, are
  listed...
-Peff
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 2 of 4 in “rev-list-options.txt: update --all about detached HEAD”
  1. rev-list-options.txt: update --all about detached HEADNguyễn Thái Ngọc Duy, Feb 7, 2017
  2. Jeff KingFeb 7, 2017
  3. rev-list-options.txt: update --all about HEADNguyễn Thái Ngọc Duy, Feb 8, 2017
  4. Jeff KingFeb 8, 2017

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.