Thread (6 messages) 6 messages, 3 authors, 2025-08-02

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

From: D. Ben Knoble <hidden>
Date: 2025-08-02 16:14:20

Possibly related (same subject, not in this thread)

On Wed, Jul 30, 2025 at 5:49 PM D. Ben Knoble [off-list ref] wrote:
On Sat, Jul 26, 2025 at 8:16 PM Junio C Hamano [off-list ref] wrote:
quoted
"D. Ben Knoble" [off-list ref] writes:
quoted
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!
           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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help