git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
D. Ben Knoble <ben.knoble@gmail.com>
Date
Aug 2, 2025, 16:14 UTC
Message-ID
<CALnO6CDgjmDd9kBCLzjb=JS6Rqg33aXesjthr_Q=HCA-ru2k6g@mail.gmail.com>
In-Reply-To
<CALnO6CDNDfx6L7CmPwE0eBZFkd_JkZf6hDwrADccAb14QhJGDg@mail.gmail.com>
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
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 12 in “Why does git-grep appear to treat exclude pathspecs differently?”
  1. D. Ben KnobleJul 26, 2025
  2. Junio C HamanoJul 27, 2025
  3. D. Ben KnobleJul 30, 2025
  4. Jeff KingAug 2, 2025
  5. D. Ben KnobleAug 2, 2025
  6. Jeff KingAug 2, 2025
  7. Junio C HamanoAug 3, 2025
  8. Jeff KingAug 5, 2025
  9. Junio C HamanoAug 5, 2025
  10. Junio C HamanoAug 2, 2025
  11. D. Ben KnobleAug 2, 2025
  12. Junio C HamanoAug 2, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.