git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "David Burström" <davidburstrom@spotify.com>, git@vger.kernel.org
Subject: Re: Bug or unexpected behaviour in git show <rev>:a\b
Date: Mon, 27 Jan 2020 10:47:46 -0800	[thread overview]
Message-ID: <xmqqmua8bust.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20200125000051.GA566074@coredump.intra.peff.net> (Jeff King's message of "Fri, 24 Jan 2020 19:00:51 -0500")

Jeff King <peff@peff.net> writes:

> 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.

  parent reply	other threads:[~2020-01-27 18:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-24 12:45 Bug or unexpected behaviour in git show <rev>:a\b David Burström
2020-01-24 19:01 ` Jeff King
2020-01-24 19:27   ` Junio C Hamano
2020-01-25  0:00     ` Jeff King
2020-01-25 13:21       ` David Burström
2020-01-27 18:47       ` Junio C Hamano [this message]
2020-01-25  0:05   ` Jeff King
2020-01-25  0:06     ` [PATCH 1/3] t1400: avoid "test" string comparisons Jeff King
2020-01-25  0:06     ` [PATCH 2/3] t1506: drop space after redirection operator Jeff King
2020-01-25  0:13     ` [PATCH 3/3] sha1-name: mark get_oid() error messages for translation Jeff King
2020-01-29 21:30       ` Junio C Hamano
2020-01-29 21:42         ` Junio C Hamano
2020-01-30  7:17           ` Jeff King
2020-01-30 19:16             ` Junio C Hamano
2020-01-31  0:15               ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqmua8bust.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=davidburstrom@spotify.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).