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

Re: [RFC/PATCH] recognize pathspec magic without "--" disambiguation

From
Junio C Hamano <gitster@pobox.com>
Date
May 28, 2017, 00:04 UTC
Message-ID
<xmqqd1atc0eh.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170527203937.hto7lwxfbjvl5f7o@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 12 quoted lines
> Yeah. That's a good reason not to use ":/" without a disambiguating "--"
> (which _does_ work, even without my series, because check_filename()
> does specific path-matching). At best, you pay for a complete useless
> history traversal before the command actually starts running. But much
> more likely is that Git just complains of ambiguity, because people tend
> to mention top-level paths in their commit messages. E.g.:
>
>   $ cd t
>   $ git grep foo :/Documentation
>   fatal: ambiguous argument ':/Documentation': both revision and filename
>
> So it really is a pretty horrible syntax.

It does not allow it to be further annotated like "HEAD^{/^Merge branch 'foo'}^2". Yes, I agree that ":/string" was a pretty poor design that was done without thinking things through.

But back then in 2007, it is a bit unfair to blame the initial design for not thinking things through. There weren't as many precedents, good or bad, to learn from than we have today ;-)

Previous: Jeff King
Message 13 of 13 in “recognize pathspec magic without "--" disambiguation”
  1. recognize pathspec magic without "--" disambiguationJeff King, May 25, 2017
  2. Junio C HamanoMay 26, 2017
  3. Jeff KingMay 26, 2017
  4. 0/6 make "^:foo" work without disambiguating "--"Jeff King, May 26, 2017
  5. 1/6 t4208: add check for ":/" without matching fileJeff King, May 26, 2017
  6. 3/6 check_filename(): use skip_prefixJeff King, May 26, 2017
  7. 2/6 check_filename(): refactor ":/" handlingJeff King, May 26, 2017
  8. 4/6 check_filename(): handle ":^" path magicJeff King, May 26, 2017
  9. 6/6 verify_filename(): flip order of checksJeff King, May 26, 2017
  10. 5/6 verify_filename(): treat ":(magic)" as a pathspecJeff King, May 26, 2017
  11. Ævar Arnfjörð BjarmasonMay 27, 2017
  12. Jeff KingMay 27, 2017
  13. Junio C HamanoMay 28, 2017

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.