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

Re: [PATCH] gitk: fix --all behavior combined with --not

From
Heiko Voigt <hvoigt@hvoigt.net>
Date
Jul 10, 2019, 07:58 UTC
Message-ID
<20190710075835.GB65621@book.hvoigt.net>
In-Reply-To
<xmqqk1crwzwd.fsf@gitster-ct.c.googlers.com>
On Mon, Jul 08, 2019 at 10:16:50PM -0700, Junio C Hamano wrote:
Show 11 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
> 
> > The "--all" in rev-list family (including "git log") unconditionally
> > include HEAD.  The glitch here is that "--all" in rev-parse does
> > not.  And 4d5e1b1319 was an attempt to "fix" that, i.e. make "--all"
> > imply "HEAD".
> 
> And it becomes really tempting to get rid of that "let's tweak
> --all" hack and declare that "rev-parse --all" is simply buggy,
> proposing a simple "bugfix" that may look like this (not even
> compile tested, but you get the idea).
Thanks for this nice pointer.

Lets think about this a little more, because this would give us a proper solution. There would be a need to be backwards compatible to not break peoples scripts right? The documentation says --all "Show all refs found in refs/" so IMO we need some extra option that changes the '--all' behavior. How about '--all-include-head'. Then e.g.

    git rev-parse --all-include-head --all --not origin/master
would include the head ref like you proposed below?

What do you think? Or would you rather go the route of changing rev-parse behavior?

Cheers Heiko
Show 16 quoted lines
> 
>  builtin/rev-parse.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
> index f8bbe6d47e..94f9a6efba 100644
> --- a/builtin/rev-parse.c
> +++ b/builtin/rev-parse.c
> @@ -766,6 +766,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
>  			}
>  			if (!strcmp(arg, "--all")) {
>  				for_each_ref(show_reference, NULL);
> +				head_ref(show_reference, NULL);
>  				clear_ref_exclusion(&ref_excludes);
>  				continue;
>  			}
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 12 in “gitk: fix --all behavior combined with --not”
  1. gitk: fix --all behavior combined with --notHeiko Voigt, Jul 4, 2019
  2. Johannes SchindelinJul 4, 2019
  3. Heiko VoigtJul 4, 2019
  4. Junio C HamanoJul 8, 2019
  5. Junio C HamanoJul 9, 2019
  6. Junio C HamanoJul 9, 2019
  7. Heiko VoigtJul 10, 2019
  8. Junio C HamanoJul 10, 2019
  9. Heiko VoigtJul 11, 2019
  10. Junio C HamanoJul 11, 2019
  11. Johannes SixtJul 11, 2019
  12. Heiko VoigtJul 10, 2019

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.