Re: Git 2.7.0 gitignore behaviour regression

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

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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]