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

Re: Cannot negate `*` ignore pattern for directory with space in the name

From
VEVictor Engmark <victorengmark@catalyst.net.nz>
Date
Sep 18, 2018, 21:03 UTC
Message-ID
<4af0a71a-4b25-f09c-b238-3264e7a49058@catalyst.net.nz>
In-Reply-To
<CACsJy8Cbp+1-CXMup4m=qLgJA511X0NtM51sFma_8nmp4_EhKg@mail.gmail.com>
On 19/09/2018 05:59, Duy Nguyen wrote:
> On Tue, Sep 18, 2018 at 6:13 AM Victor Engmark
> <victorengmark@catalyst.net.nz> wrote:
[…]
Show 8 quoted lines
>> $ cat > .gitignore << EOF
>>> *
>>> !foo bar
>>> !foo\ bar
>>> !"foo bar"
> 
> No need to quote, either with double quotes or backslashes. They are
> interpreted as literal " and \
Thanks! I just tried a bunch of things to see if anything stuck.
Show 8 quoted lines
>> $ git status --short
>> [no output]
> 
> It's not exactly a bug, more like a trap. '*' matches anything, at
> every level. So even if you negate 'foo bar', when we check 'foo
> bar/test', '*' pattern applies again and ignores 'foo bar/test'. If
> the first line in .gitignore is /* instead of * (to keep match
> anything at the top level directory only), then it should work.

You're right, I've managed to induce the placebo effect in myself :) Thank you for the help, and sorry for the noise!

-- 
Cheers
Victor
Previous: Duy Nguyen
Message 3 of 3 in “Cannot negate `*` ignore pattern for directory with space in the name”
  1. Victor EngmarkSep 18, 2018
  2. Duy NguyenSep 18, 2018
  3. Victor EngmarkSep 18, 2018

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.