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 6, 2019, 17:38 UTC
Message-ID
<20190806173817.GB4961@sigill.intra.peff.net>
In-Reply-To
<000f01d54c75$1a8fe460$4fafad20$@nexbridge.com>
On Tue, Aug 06, 2019 at 12:36:26PM -0400, Randall S. Becker wrote:
Show 7 quoted lines
> > > This series provides an alternative to "--" to stop option parsing
> > > without indicating that further arguments are pathspecs.
> 
> Would this offer the opportunity to, in the long term, supply options to
> external diff engines, for example?
> 
> Something like git diff --end-of-options --diff-opt1 --diff-opt2 -- a b

I'd expect that to interpret "--diff-opt1" and "--diff-opt2" as non-option arguments, which in the context of git-diff means endpoints of the diff.

So no, I don't think you can use it like you're asking here.
Show 6 quoted lines
> I'm just noodling here, wondering why otherwise
> 
> git rev-list --max-parents=4  -- --count docs/
> 
> does not work. I thought -- was pretty specific in terms of turning off
> interpretation. So is it not a defect that --count is being interpreted?

The command-line above means that "--count" is interpreted (unambiguously) as a path. The problem is that if you want it to be interpreted as a starting point for traversal, then it must come _before_ the "--".

> I have a fear for all my sub-teams who script with the assumption that --
> has a specific meaning of stopping interpretation.

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.

-Peff
Previous: Randall S. BeckerNext: Randall S. Becker
Message 7 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.