Re: Why does git-grep appear to treat exclude pathspecs differently?
From: Junio C Hamano <hidden>
Date: 2025-08-02 17:23:13
From: Junio C Hamano <hidden>
Date: 2025-08-02 17:23:13
"D. Ben Knoble" [off-list ref] writes:
quoted
quoted
quoted
- "git ls-files :^:Documentation/RelNotes | grep Rel" yields "RelNotes", as expectedIt 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.