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

Re: [PATCH 3/3] rev-parse: handle --end-of-options

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 10, 2020, 22:23 UTC
Message-ID
<xmqqr1p06ec9.fsf@gitster.c.googlers.com>
In-Reply-To
<20201110214019.GC788740@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 9 quoted lines
> This patch lets callers write:
>
>   git rev-parse --end-of-options "$rev" -- "$path"
>
> and:
>
>   git rev-parse --verify --end-of-options "$rev"
>
> which will both treat "$rev" always as a revision parameter.

Nice. The only iffy case I can think of is that we can never have "--" to specify a rev, because with "git cmd -- -- path" we don't know which double-dash among the two is the disambiguator that makes the other double-dash to be either rev or path, but that is not a new problem with this change.

Show 6 quoted lines
> +test_expect_success 'verify respects --end-of-options' '
> +	git update-ref refs/heads/-tricky HEAD &&
> +	git rev-parse --verify HEAD >expect &&
> +	git rev-parse --verify --end-of-options -tricky >actual &&
> +	test_cmp expect actual
> +'
;-)  Or refs/heads/--tricky?
The whole thing looked good.  Thanks.
Previous: Jeff KingNext: Demi M. Obenour
Message 7 of 10 in “check_refname_format allows refs with components that begin with -, even though `git tag` does not”
  1. Demi M. ObenourNov 10, 2020
  2. Junio C HamanoNov 10, 2020
  3. Jeff KingNov 10, 2020
  4. 2/3 rev-parse: put all options under the "-" checkJeff King, Nov 10, 2020
  5. 1/3 rev-parse: don't accept options after dashdashJeff King, Nov 10, 2020
  6. 3/3 rev-parse: handle --end-of-optionsJeff King, Nov 10, 2020
  7. Junio C HamanoNov 10, 2020
  8. Demi M. ObenourNov 10, 2020
  9. Jeff KingNov 11, 2020
  10. Ævar Arnfjörð BjarmasonNov 10, 2020

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.