git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Cannot negate `*` ignore pattern for directory with space in the name
@ 2018-09-18  4:03 Victor Engmark
  2018-09-18 17:59 ` Duy Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Victor Engmark @ 2018-09-18  4:03 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-18 21:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-18  4:03 Cannot negate `*` ignore pattern for directory with space in the name Victor Engmark
2018-09-18 17:59 ` Duy Nguyen
2018-09-18 21:03   ` Victor Engmark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).