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

Re: [PATCH 0/3] --end-of-options marker

From
Jeff King <peff@peff.net>
Date
Aug 8, 2019, 10:03 UTC
Message-ID
<20190808100318.GC12257@sigill.intra.peff.net>
In-Reply-To
<20190806181459.GG20404@szeder.dev>
On Tue, Aug 06, 2019 at 08:14:59PM +0200, SZEDER Gábor wrote:
Show 11 quoted lines
> On Tue, Aug 06, 2019 at 01:38:17PM -0400, Jeff King wrote:
> > Nothing about "--" is changed by my series; it will still stop option
> > interpretation in rev-list and in other commands. But as before,
> > rev-list (and other Git commands that use the revision.c parser) use it
> > to separate revisions and pathspecs.  That's unlike how most other
> > programs use "--", but that ship sailed for Git in 2005.
> 
> I'd like to draw attention to the oddball 'git filter-branch' command,
> which uses '--' as a separator between 'filter-branch' and 'rev-list'
> options.  Will it still work with this new option?  I think it will,
> but not sure.
Good question.

Certainly "--" will work as it did before, since the code here only changes behavior when it sees --end-of-options.

filter-branch doesn't use any of our parseopt infrastructure itself, so it won't understand the new option itself. I.e., this won't work[1]:

  git filter-branch --end-of-options -this-is-a-branch-name

But since it passes rev-list options as-is, this does successfully pass the name to rev-list:

  git filter-branch -- --end-of-options -this-is-a-branch-name

However, filter-branch itself seems to do some magic of its own with the rev-list options, and will try to filter HEAD in that case. So I think it needs further work to cover all cases correctly.

-Peff
[1] I think the first one there would work if filter-branch actually
    used "rev-parse --parseopt". E.g.:
      git rev-parse --parseopt -- --foo --end-of-options --bar <<-\EOF
      cmd
      --
      foo    an option
      bar    another option
      EOF
    yields:
      set -- --foo -- '--bar'
Previous: SZEDER GáborNext: Jeff King
Message 10 of 16 in “--end-of-options marker”
  1. 0/3 --end-of-options markerJeff King, Aug 6, 2019
  2. 1/3 revision: allow --end-of-options to end option parsingJeff King, Aug 6, 2019
  3. 2/3 parse-options: allow --end-of-options as a synonym for "--"Jeff King, Aug 6, 2019
  4. 3/3 gitcli: document --end-of-optionsJeff King, Aug 6, 2019
  5. Junio C HamanoAug 6, 2019
  6. Randall S. BeckerAug 6, 2019
  7. Jeff KingAug 6, 2019
  8. Randall S. BeckerAug 6, 2019
  9. SZEDER GáborAug 6, 2019
  10. Jeff KingAug 8, 2019
  11. Jeff KingAug 6, 2019
  12. brian m. carlsonAug 6, 2019
  13. Jeff KingAug 6, 2019
  14. brian m. carlsonAug 7, 2019
  15. Taylor BlauAug 7, 2019
  16. Jeff KingAug 8, 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.