Re: Git 2.7.0 gitignore behaviour regression
From: Duy Nguyen <hidden>
Date: 2016-06-15 23:07:39
On Fri, Jan 8, 2016 at 6:44 AM, brian m. carlson [off-list ref] wrote:
On Tue, Jan 05, 2016 at 10:06:02AM -0500, Jeff King wrote:quoted
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 think there's still a bug in the code here. If you do git init mkdir -p base/a/ printf 'base/a/\n!base/a/b.txt\n' >.gitignore
Here we have the ignore rule "base/a/", but gitignore.txt, section NOTES mentions this - The rules to exclude the parent directory must not end with a trailing slash.
git add .gitignore git commit -m 'Add .gitignore' >base/a/b.txt git add base/a/b.txt git commit -m 'Add base/a/b.txt' >base/a/c.txt git status --porcelain git status outputs base/a/c.txt as unknown, when it should be ignored. We saw this in a repository at $DAYJOB.
If I delete that trailing slash, c.txt is ignored. So it's known limitation. I think we can make trailing slash case work too, but if I remember correctly it would involve a lot more changes, so I didn't do it (there are other conditions to follow anyway to make it work). -- Duy