Change in .gitignore handling: intended or bug?
- From
Charles Strahan <charles@cstrahan.com>
- Date
- Mar 4, 2016, 02:11 UTC
- Message-ID
- <1457057516.1962831.539160698.3C8B30BC@webmail.messagingengine.com>
Hello,
I've found a change in the way .gitignore works, and I'm not sure if it's a bug or intended.
Previously, one could use the following .gitignore:
*
!/foo
!/foo/bar.txt
!/baz
!/baz/quux
!/baz/quux/**/*And these files would be seen by git:
foo/bar.txt
baz/quux/grault.txt
baz/quux/corge/wibble.txtAnd these files would be ignored:
foo/garply.txt
baz/waldo.txtAt some point (between git 2.6.0 and 2.7.0, I think), the behavior changed such that _none_ of the files above would be ignored. Previously, git would treat !/foo as an indication that it should not prune /foo, but that _wouldn't_ be sufficient to un-ignore the contents thereof. Now, it seems the new scheme treats !/foo as functionally equivalent to !/foo followed by !/foo/**/* in the old scheme.
I manage my home directory by making it a git repo, and using ~/.gitignore to selectively permit certain files or subdirectories to be seen by git. The recent change in behavior has resulted in sensitive directories like ~/.gpg being un-ignored. For reference, I've appended my .gitignore to the end of this email.
So, is this behavior intended, or is this a bug? If the former, is there an announcement explaining this change?
-Charles
(.gitignore is as follows)
* !/.Xdefaults !/.Xresources !/.ackrc !/.bash_profile !/.config !/.config/dunst !/.config/dunst/dunstrc !/.config/taffybar !/.config/taffybar/taffybar.hs !/.config/taffybar/taffybar.rc !/.ctags !/.gdb !/.gdb/**/* !/.gdbinit !/.gemrc !/.ghci !/.git_template !/.git_template/**/* !/.gitexcludes !/.gitignore !/.gnupg !/.gnupg/dirmngr.conf !/.gnupg/gpg.conf !/.goobook/ !/.goobook/decipher !/.goobook/decipher/goobookrc !/.inputrc !/.irbrc !/.irssi !/.irssi/**/* !/.mbsyncrc !/.msmtprc !/.mutt !/.mutt/accounts !/.mutt/accounts/* !/.mutt/gpg.rc !/.mutt/mailcap !/.mutt/muttrc !/.mutt/signature !/.mutt/theme/* !/.nixpkgs !/.nixpkgs/**/* !/.notmuch-config !/.pystartup !/.tmux !/.tmux.conf !/.tmux/**/* !/.vim !/.vim/**/* !/.vimrc !/.xmonad !/.xmonad/xmonad.hs !/.xsession !/.zlogin !/.zprofile !/.zsh !/.zsh/**/* !/.zshenv !/.zshrc !/osx