From: Jeff King <peff@peff.net>
To: Mike McQuaid <mike@mikemcquaid.com>
Cc: git@vger.kernel.org
Subject: Re: Git 2.7.0 gitignore behaviour regression
Date: Tue, 5 Jan 2016 10:06:02 -0500 [thread overview]
Message-ID: <20160105150602.GA4130@sigill.intra.peff.net> (raw)
In-Reply-To: <4B0F686D-3DF9-4E5D-971D-DB106C6573FD@mikemcquaid.com>
On Tue, Jan 05, 2016 at 02:40:16PM +0000, Mike McQuaid wrote:
> Homebrew has a series of convoluted .gitignore rules due to our
> special/weird use-case of wanting to ignore everything in a working
> directory except a select few files/directories. We experienced a bug
> with our .gitignore file for users using Git 2.7.0. This may well be a
> valid WONTFIX or intentional behaviour change but I wanted to flag it
> in case it wasn’t.
>
> Here’s a minimal test case:
>
> - Create an empty git repository in a directory with `git init`
> - Create a directory named ‘a' containing a file named ‘b' with `mkdir a && touch a/b`
> - Create a ‘gitignore’ file with the following contents:
> ```
> */
> /a
> !/a/*
> ```
> - Run `git status --short`.
>
> The output with Git 2.6.4 is:
> ```
> ?? .gitignore
> ```
>
> The output with Git 2.7.0 is:
> ```
> ?? .gitignore
> ?? a/
> ```
Thanks for giving a clear example. This bisects to Duy's 57534ee (dir.c:
don't exclude whole dir prematurely if neg pattern may match,
2015-09-21). AFAICT (and I don't recall looking over this patch
previously), what you are seeing is the intended effect of the patch.
Your final line unignores stuff inside of "a", so we're reporting it (if you gave
"-uall", you'd see the actual file "a/b"). Older versions of git
generally optimized out looking inside "a/" at all. This created a
hassle when people wanted to do things like:
a/
!a/precious-file
in their .gitignore.
I'm sympathetic that in making that use-case work, we might have
regressed another one, but it's hard to tell from the small example. Can
you elaborate on your use case? Why are you both ignoring and unignoring
everything in the directory?
-Peff
next prev parent reply other threads:[~2016-01-05 15:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-05 14:40 Git 2.7.0 gitignore behaviour regression Mike McQuaid
2016-01-05 15:06 ` Jeff King [this message]
2016-01-06 9:42 ` Duy Nguyen
2016-01-06 9:50 ` Mike McQuaid
2016-01-06 10:03 ` Duy Nguyen
2016-01-06 18:58 ` Junio C Hamano
2016-01-07 2:04 ` Jeff King
2016-01-07 2:13 ` Duy Nguyen
2016-01-08 1:47 ` Carlos Martín Nieto
2016-01-07 23:44 ` brian m. carlson
2016-01-08 0:38 ` Duy Nguyen
2016-01-08 2:41 ` brian m. carlson
2016-01-08 9:02 ` Duy Nguyen
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=20160105150602.GA4130@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=mike@mikemcquaid.com \
/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).