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

Re: something like git-check-ignore but considering only patterns?

From
Elijah Newren <newren@gmail.com>
Date
Dec 29, 2021, 23:15 UTC
Message-ID
<CABPp-BEQdpO5=j_f2MjgZjhudNZgKhDgV31M_Cy6Agx_U=KweQ@mail.gmail.com>
In-Reply-To
<CAC4O8c-2sxHyAjtd4jZQcjzX4d9+19AUx-h13nttjwP=pd1Ukw@mail.gmail.com>
On Wed, Dec 29, 2021 at 12:54 PM Britton Kerin <britton.kerin@gmail.com> wrote:
Show 5 quoted lines
>
> I'd like to query if a file e.g. symLinkToDir/foo.o would be ignored
> if it were in a real dir instead (don't ask) but in a general way and
> hopefully without parsing and matching all the .gitignore entries
> myself.  Is it possible?
How would that even work?  If there is just one gitignore pattern and it was:
    build/*
And you tried to ask (making up a new `--patterns` flag):
    git check-ignore --patterns '*/foo.o'

What should the command return? True? False? It kinda depends on what that '*' actually is. If it's "build" then it's ignored. If it's not, then for this example it wouldn't be ignored. So the best answer we would be able to give is "maybe", which isn't particularly useful. Also, typical cases will be much more complex than that. So we can only answer whether specific paths are ignored, not whether various globs would be.

Previous: Britton KerinNext: Britton Kerin
Message 2 of 3 in “something like git-check-ignore but considering only patterns?”
  1. Britton KerinDec 28, 2021
  2. Elijah NewrenDec 29, 2021
  3. Britton KerinJan 2, 2022

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.