Subject: Re: Why does git-grep appear to treat exclude pathspecs differently?

From: Junio C Hamano <[email-masked]>
Date: Sat, 02 Aug 2025 10:23:10 -0700

"D. Ben Knoble" <[email-masked]> writes:

>> > > - "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":

Because the most natural way to spell it is ":!Documentation/RelNotes"
not ":^:Documentation/RelNotes"?  

And that is why I did not say "invalid way to spell".  It just was
unnecessarily unfamiliar form to say the same thing.

But as you need more than one "prefix" to the real pathname to
trigger the bug in the disambiguation code, :! alone would not have
exhibited the symptom, and you would have needed something
multi-letter like :!: or :!/ in front of that path.