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

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

From
VEVictor Engmark <victorengmark@catalyst.net.nz>
Date
Sep 18, 2018, 04:03 UTC
Message-ID
<955f404f-83ed-758e-017b-d6b4a1f69ef7@catalyst.net.nz>
To reproduce (from <https://unix.stackexchange.com/q/469708/3645>):

$ cd "$(mktemp --directory)" $ mkdir foo\ bar $ touch foo\ bar/test $ git init Initialized empty Git repository in /tmp/tmp.iGmBR6y2xR/.git/ $ git status --short ?? foo bar/ $ cat > .gitignore << EOF

Show 12 quoted lines
> *
> !foo bar
> !foo\ bar
> !"foo bar"
> "!foo bar"
> !foo*
> !foo bar/
> !foo\ bar/
> !"foo bar/"
> "!foo bar/"
> !foo*/
> EOF

$ git status --short [no output]

The pattern *can* be negated if it only matches directories:
$ cat > .gitignore << EOF
> */
> !foo\ bar/
> EOF

$ git status --short ?? .gitignore ?? foo bar/

I encountered this problem because Visual Studio Code creates a configuration directory called "Code - OSS", and I exclude everything in ~/.config by default to avoid noise in `git status`.

$ git --version git version 2.19.0

-- 
Kind regards
Victor Engmark
Next: Duy Nguyen
Message 1 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.