Re: Why does git-grep appear to treat exclude pathspecs differently?
On Wed, Jul 30, 2025 at 5:49 PM D. Ben Knoble <ben.knoble@gmail.com> wrote:
Show 13 quoted lines
>
> On Sat, Jul 26, 2025 at 8:16 PM Junio C Hamano <gitster@pobox.com> wrote:
> >
> > "D. Ben Knoble" <ben.knoble@gmail.com> writes:
> >
> > > With Git 2.48.1, I observe the following behavior:
> > >
> > > - "git ls-files :^:Documentation/RelNotes | grep Rel" yields
> > > "RelNotes", as expected
> >
> > It is deliberately confusing to spell ":(exclude)" as ":^:".
>
> What makes you say that? It's documented in "git help revisions":
Er, that's "git help glossary" for the quotes below—woops!
Show 13 quoted lines
>
> A pathspec that begins with a colon : has special meaning. In the
> short form, the leading colon : is followed by zero or more "magic
> signature" letters (which optionally is terminated by another colon
> :), and the remainder is the pattern to match against the path.
>
> and
>
> exclude
> After a path matches any non-exclude pathspec, it will be run
> through all exclude pathspecs (magic signature: ! or its synonym
> ^).
>
--
D. Ben Knoble