git ignore regression in 1.8.3

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

 



Hi all,

First of all I would like to thank you all for the great tool that is
git. I love it and it makes my days way better.
This is my first post on this mailing list so please apology if there
is something wrong.

I have noticed a regression in the behavior of ignore rules in 1.8.3.
I have read the release notes and it might be related to all the great
optimization you guys have done.
My use case is quite uncommon but may happens to people who are
tracking their "dot files" like I do.
Basically I have a whitelist of non-ignored files at the top of my
repository and a blacklist of ignored file in some of the direct
sub-directories.

Example:
$ cd /tmp
$ mkdir repo
$ cd repo
$ git init
$ mkdir d
$ touch tracked d/tracked
$ git add tracked d/tracked
$ git commit -m "Initial commit"
$ touch untracked d/untracked
$ touch ignored d/ignored
$ echo '/*' >> .gitignore
$ echo '!/d/' >> .gitignore
$ echo '!/*' >> d/.gitignore
$ echo 'ignored' >> d/.gitignore
$ cat .gitignore
/*
!/d/
$ cat d/.gitignore
!/*
ignored
$ git --version
git version 1.8.3
$ git status -sb
## master
?? d/.gitignore
?? d/ignored
?? d/untracked
$ /usr/local/Cellar/git/1.8.2.3/bin/git --version
git version 1.8.2.3
$ /usr/local/Cellar/git/1.8.2.3/bin/git status -sb
## master
?? d/.gitignore
?? d/untracked
$ git config status.showUntrackedFiles
$ git check-ignore -v d/ignored
.gitignore:2:!/d/ d/ignored
$ /usr/local/Cellar/git/1.8.2.3/bin/git check-ignore -v d/ignored
.gitignore:2:!/d/ d/ignored

Although I am confused by the fact that both version of check-ignore
print the same result, my understanding of this behavior is that the
"local" d/.gitignore file is not taken into account and that once a
negate rule is set I can not include other sub-pattern any longer. I
have tried to only use the root .gitignore file like this

/*
!/d/
/d/ignored

but I have the same result. Removing the trailing slash in the
negative pattern (like this !/d) does not change anything. If I use
!/d/*, both version of git-status no longer report d/untracked.

I was happy with the 1.8.2.3 behavior. Maybe I misunderstand the new
behavior of 1.8.3. If yes please tell me how I could achieve the same
tricks in 1.8.3 because I did not find out how.
I have the same result with the next branch (version 1.8.3.430.gc6abf3f).

I have never hacked into git code base but I am willing to help if
someone can guide me a bit.

Regards,

--
Nicolas Desprès
--
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]