git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Victor Engmark <victorengmark@catalyst.net.nz>
To: git@vger.kernel.org
Subject: Cannot negate `*` ignore pattern for directory with space in the name
Date: Tue, 18 Sep 2018 16:03:33 +1200	[thread overview]
Message-ID: <955f404f-83ed-758e-017b-d6b4a1f69ef7@catalyst.net.nz> (raw)

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

             reply	other threads:[~2018-09-18  4:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-18  4:03 Victor Engmark [this message]
2018-09-18 17:59 ` Cannot negate `*` ignore pattern for directory with space in the name Duy Nguyen
2018-09-18 21:03   ` Victor Engmark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=955f404f-83ed-758e-017b-d6b4a1f69ef7@catalyst.net.nz \
    --to=victorengmark@catalyst.net.nz \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).