{"thread":{"id":"34038","subject":"Ignoring pattern in un-ignored directory not working anymore","startedAt":"2013-06-06T08:29:08Z","lastAt":"2013-06-06T21:08:20Z","messageCount":3,"participants":["Moritz Bunkus","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"219490","messageId":"CANPayMS19-bjgWRMYrRcGYzKgEo_0Az_8emeDrKwxx9RguDbwg@mail.gmail.com","threadId":"34038","inReplyTo":null,"subject":"Ignoring pattern in un-ignored directory not working anymore","fromName":"Moritz Bunkus","fromEmail":"moritz@bunkus.org","sentAt":"2013-06-06T08:29:08Z","receivedAt":"2013-06-06T08:29:08Z","isPatch":false,"sender":{"key":"moritz@bunkus.org","avatar":null},"body":"Hey,\n\nWhat I want to do:\n\n* ignore certain patterns completely\n* but keep one important directoy\n* but not the patterns from the first step that are located within\nthat directory.\n\nConcrete example: I'm tracking certain parts of my $HOME including\n~/.emacs.d/ -- but I don't want the compiled Emacs Lisp files therein.\n\nThis used to work until recently, though I'm not sure up to which\nversion excatly. I'm on Arch Linux and therefore usually pretty much\nup to date. My current git version is 1.8.3.\n\nMore details and how to reproduce:\n\nMy ~/.gitignore usually looked like this:\n\n--- cut ---------------------------------------------------------\n/*\n*.elc\n!/.emacs.d/\n--- cut ---------------------------------------------------------\n\nWith this setup the scenario described at the beginning was possible.\nNow it's not as all files within ~/.emacs.d are always considered\nregardless of what patterns came before.\n\nNot even putting '*.elc' into ~/.emacs.d/.gitignore will work in such\na case, even though gitignore(5) seems to imply that .gitignore files\ncloser to the actual file have higher precendence.\n\nHere's a copy & paste of a simple session demonstrating the problem on\na new repo:\n\n--- cut ---------------------------------------------------------\n[0 mbunkus@chai-latte ~/tmp/repo] git init\nInitialized empty Git repository in /home/mbunkus/tmp/repo/.git/\n[0 mbunkus@chai-latte (branchless-repo) ~/tmp/repo] cat > .gitignore\n# Ignore all compiled Emacs lisp files\n*.elc\n# But I want this one directory\n!important/\n[0 mbunkus@chai-latte (branchless-repo) ~/tmp/repo] mkdir important\n[0 mbunkus@chai-latte (branchless-repo) ~/tmp/repo] touch important/wanted.el\n[0 mbunkus@chai-latte (branchless-repo) ~/tmp/repo] git add important\n[0 mbunkus@chai-latte (branchless-repo) ~/tmp/repo] git commit -m 'all ok'\n[master (root-commit) 5ab6055] all ok\n 1 file changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 important/wanted.el\n[0 mbunkus@chai-latte (master) ~/tmp/repo] touch unwanted1.elc\n[0 mbunkus@chai-latte (master) ~/tmp/repo] touch important/unwanted2.elc\n[0 mbunkus@chai-latte (master) ~/tmp/repo] git status\n# On branch master\n# Untracked files:\n#   (use \"git add <file>...\" to include in what will be committed)\n#\n#       .gitignore\n#       important/unwanted2.elc\nnothing added to commit but untracked files present (use \"git add\" to track)\n[0 mbunkus@chai-latte (master) ~/tmp/repo] cat > .gitignore\n# Second try: list *.elc twice\n*.elc\n!important/\n*.elc\n[0 mbunkus@chai-latte (master) ~/tmp/repo] git status\n# On branch master\n# Untracked files:\n#   (use \"git add <file>...\" to include in what will be committed)\n#\n#       .gitignore\n#       important/unwanted2.elc\nnothing added to commit but untracked files present (use \"git add\" to track)\n[0 mbunkus@chai-latte (master) ~/tmp/repo] cat > .gitignore\n# Third times' the charm\n*.elc\n!important/\nimportant/**/*elc\n[0 mbunkus@chai-latte (master) ~/tmp/repo] git status\n# On branch master\n# Untracked files:\n#   (use \"git add <file>...\" to include in what will be committed)\n#\n#       .gitignore\n#       important/unwanted2.elc\nnothing added to commit but untracked files present (use \"git add\" to track)\n[0 mbunkus@chai-latte (master) ~/tmp/repo] echo '*.elc' > important/.gitignore\n[0 mbunkus@chai-latte (master) ~/tmp/repo] git status\n# On branch master\n# Untracked files:\n#   (use \"git add <file>...\" to include in what will be committed)\n#\n#       .gitignore\n#       important/.gitignore\n#       important/unwanted2.elc\nnothing added to commit but untracked files present (use \"git add\" to track)\n--- cut ---------------------------------------------------------\n\nKind regards,\nmosu\n"},{"id":"219524","messageId":"7vfvwvyudh.fsf@alter.siamese.dyndns.org","threadId":"34038","inReplyTo":"CANPayMS19-bjgWRMYrRcGYzKgEo_0Az_8emeDrKwxx9RguDbwg@mail.gmail.com","subject":"Re: Ignoring pattern in un-ignored directory not working anymore","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-06T18:19:38Z","receivedAt":"2013-06-06T18:19:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Moritz Bunkus <moritz@bunkus.org> writes:\n\n> This used to work until recently, though I'm not sure up to which\n> version excatly. I'm on Arch Linux and therefore usually pretty much\n> up to date. My current git version is 1.8.3.\n\nCould you test if 'master' at 3684101a654d (Merge branch\n'kb/status-ignored-optim-2', 2013-06-03) or later fixes it?\n\nThanks.\n"},{"id":"219560","messageId":"CANPayMQXw9noi-SJa0hZSsUzPd_fN6eVEXwW=uJdwqPPZmVCxw@mail.gmail.com","threadId":"34038","inReplyTo":"7vfvwvyudh.fsf@alter.siamese.dyndns.org","subject":"Re: Ignoring pattern in un-ignored directory not working anymore","fromName":"Moritz Bunkus","fromEmail":"moritz@bunkus.org","sentAt":"2013-06-06T21:08:20Z","receivedAt":"2013-06-06T21:08:20Z","isPatch":false,"sender":{"key":"moritz@bunkus.org","avatar":null},"body":"Hey,\n\nyes, the problem is gone at 3684101a654d. Thanks.\n\nKind regards,\nmosu\n"}]}