git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git ignore regression in 1.8.3

From
NDNicolas Desprès <nicolas.despres@gmail.com>
Date
May 29, 2013, 12:31 UTC
Message-ID
<CAPqtr1KjmqRZZuVwput6=rKJrivb7siYePqT5QEOLJApg+phEg@mail.gmail.com>
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

Next: Duy Nguyen
Message 1 of 4 in “git ignore regression in 1.8.3”
  1. Nicolas DesprèsMay 29, 2013
  2. Duy NguyenMay 29, 2013
  3. Felipe ContrerasMay 29, 2013
  4. Nicolas DesprèsMay 29, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.