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

Re: Bug or unexpected behaviour in git show <rev>:a\b

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 27, 2020, 18:47 UTC
Message-ID
<xmqqmua8bust.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20200125000051.GA566074@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 23 quoted lines
> Subject: verify_filename(): handle backslashes in "wildcards are pathspecs" rule
>
> Commit 28fcc0b71a (pathspec: avoid the need of "--" when wildcard is
> used, 2015-05-02) allowed:
>
>   git rev-parse '*.c'
>
> without the double-dash. But the rule it uses to check for wildcards
> actually looks for any glob special. This is overly liberal, as it means
> that a pattern that doesn't actually do any wildcard matching, like
> "a\b", will be considered a pathspec.
>
> If you do have such a file on disk, that's presumably what you wanted.
> But if you don't, the results are confusing: rather than say "there's no
> such path a\b", we'll quietly accept it as a pathspec which very likely
> matches nothing (or at least not what you intended). Likewise, looking
> for path "a\*b" doesn't expand the search at all; it would only find a
> single entry, "a*b".
>
> This commit switches the rule to trigger only when glob metacharacters
> would expand the search, meaning both of those cases will now report an
> error (you can still disambiguate using "--", of course; we're just
> tightening the DWIM heuristic).
Makes sense.  Thanks.
Previous: David BurströmNext: Jeff King
Message 6 of 15 in “Bug or unexpected behaviour in git show <rev>:a\b”
  1. David BurströmJan 24, 2020
  2. Jeff KingJan 24, 2020
  3. Junio C HamanoJan 24, 2020
  4. Jeff KingJan 25, 2020
  5. David BurströmJan 25, 2020
  6. Junio C HamanoJan 27, 2020
  7. Jeff KingJan 25, 2020
  8. 1/3 t1400: avoid "test" string comparisonsJeff King, Jan 25, 2020
  9. 2/3 t1506: drop space after redirection operatorJeff King, Jan 25, 2020
  10. 3/3 sha1-name: mark get_oid() error messages for translationJeff King, Jan 25, 2020
  11. Junio C HamanoJan 29, 2020
  12. Junio C HamanoJan 29, 2020
  13. Jeff KingJan 30, 2020
  14. Junio C HamanoJan 30, 2020
  15. Jeff KingJan 31, 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.