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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
> *
> !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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux