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

Re: --end-of-options inconsistently available?!

From
SSSven Strickroth <sven@cs-ware.de>
Date
Nov 28, 2023, 08:40 UTC
Message-ID
<ab14260c-d515-425e-8ef6-5739d3d6ca4e@cs-ware.de>
In-Reply-To
<20231127212254.GA87495@coredump.intra.peff.net>
Am 27.11.2023 um 22:22 schrieb Jeff King:
Show 23 quoted lines
>> $ git rev-parse --symbolic-full-name --end-of-options master
>> --end-of-options
>> refs/heads/master
>>
>> Here, the output also contains "--end-of-options" as if it is a reference
>> (same for "--")
> 
> This one is intentional. rev-parse in its default mode is not just
> spitting out revisions, but also options that are meant to be passed
> along to the revision machinery via other commands (like rev-list). So
> for example:
> 
>    $ git rev-parse --foo HEAD
>    --foo
>    564d0252ca632e0264ed670534a51d18a689ef5d
> 
> And it does understand end-of-options explicitly, so:
> 
>    $ git rev-parse --end-of-options --foo --
>    --end-of-options
>    fatal: bad revision '--foo'
> 
> If you just want to parse a name robustly, use --verify.

I would expect that -- and --end-of-options are handled in a special way here so that rev-parse can also be used in scripts. I need to check whether --verify works for me (from the manual I thought I need to specify full reference names).

>> $ git checkout -f --end-of-options HEAD~1 -- afile.txt
>> fatal: only one reference expected, 2 given.
> 
> I think this is the same KEEP_DASHDASH problem as with git-reset.

I also found another problem: $ git format-patch --end-of-options -1 fatal: option '-1' must come before non-option arguments

Where -1 is the number of commits here...
Best,
  Sven
Previous: Jeff KingNext: Jeff King
Message 3 of 5 in “--end-of-options inconsistently available?!”
  1. Sven StrickrothNov 27, 2023
  2. Jeff KingNov 27, 2023
  3. Sven StrickrothNov 28, 2023
  4. Jeff KingDec 6, 2023
  5. parse-options: decouple "--end-of-options" and "--"Jeff King, Dec 6, 2023

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.