{"thread":{"id":"45921","subject":"bug with git add and .gitignore","startedAt":"2017-05-10T13:44:34Z","lastAt":"2017-05-16T19:11:26Z","messageCount":2,"participants":["Orgad Shaneh","Samuel Lijin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"319272","messageId":"CAGHpTBLGwGXZk=xAB+Pb4GvtqN8+K=8BuaA-zov9sZZat-OYHQ@mail.gmail.com","threadId":"45921","inReplyTo":null,"subject":"bug with git add and .gitignore","fromName":"Orgad Shaneh","fromEmail":"orgads@gmail.com","sentAt":"2017-05-10T13:44:27Z","receivedAt":"2017-05-10T13:44:34Z","isPatch":false,"sender":{"key":"orgads@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1246544?v=4"},"body":"Hi,\n\nWhen a not-ignored file inside an ignore directory is added along with\nother files, a false alarm is shown:\n\ngit init\necho /d/ > .gitignore\nmkdir d\ntouch d/file foo\ngit add -f d/file foo\ngit add d/file\n# fine\ngit add d/file foo\n# The following paths are ignored by one of your .gitignore files:\n# d\n# Use -f if you really want to add them.\n\nI did not try to add a new file in d. It's the same file that is\nalready indexed.\n\n- Orgad\n"},{"id":"319952","messageId":"CAJZjrdUPU8bGji9yCv-8CWN2zaV8WSkvTv+9c3Q5pmnrgyaEXw@mail.gmail.com","threadId":"45921","inReplyTo":"CAGHpTBLGwGXZk=xAB+Pb4GvtqN8+K=8BuaA-zov9sZZat-OYHQ@mail.gmail.com","subject":"Re: bug with git add and .gitignore","fromName":"Samuel Lijin","fromEmail":"sxlijin@gmail.com","sentAt":"2017-05-16T19:10:40Z","receivedAt":"2017-05-16T19:11:26Z","isPatch":false,"sender":{"key":"sxlijin@gmail.com","avatar":"https://gravatar.com/avatar/01777bf1eae64e2b4dca97dcac182a6abbcf6fd8cb4d5b8fa33edf9f8cc21746?d=mp&s=160"},"body":"On Wed, May 10, 2017 at 9:44 AM, Orgad Shaneh <orgads@gmail.com> wrote:\n> Hi,\n>\n> When a not-ignored file inside an ignore directory is added along with\n> other files, a false alarm is shown:\n>\n> git init\n> echo /d/ > .gitignore\n> mkdir d\n> touch d/file foo\n> git add -f d/file foo\n> git add d/file\n> # fine\n> git add d/file foo\n> # The following paths are ignored by one of your .gitignore files:\n> # d\n> # Use -f if you really want to add them.\n\nFor anyone who wants to take a shot at this, the reason this happens\nis because when \"add d/file foo\" is invoked, when add.c:cmd_add()\ncalls fill_directory(), d/ gets added to dir->ignored, so add_files()\ncomplains. I'm not sure if that's *supposed* to happen, and the issue\nis somewhere else, or the call to read_directory_recursive() from\nfill_directory() doesn't properly respect the pathspec.\n\n> I did not try to add a new file in d. It's the same file that is\n> already indexed.\n>\n> - Orgad\n"}]}