{"thread":{"id":"49392","subject":"git check-ignore ignores negated entries","startedAt":"2018-09-20T17:22:39Z","lastAt":"2018-09-21T16:13:39Z","messageCount":2,"participants":["David Alphus","Duy Nguyen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"358521","messageId":"CAB=bJ9Mjw2keJ3aspLWcreLBcB15Eq-WjtBO0XS8B=C3XJmx9A@mail.gmail.com","threadId":"49392","inReplyTo":null,"subject":"git check-ignore ignores negated entries","fromName":"David Alphus","fromEmail":"david.alphus@gmail.com","sentAt":"2018-09-20T17:22:25Z","receivedAt":"2018-09-20T17:22:39Z","isPatch":false,"sender":{"key":"david.alphus@gmail.com","avatar":null},"body":"If a .gitignore contains a ! entry, git check-ignore will still say\nthe matching file is ignored if the file is not in the index.\n\nSimple case to reproduce:\n\n$ git init .\n$ echo \"*.c\" > .gitignore\n$ echo '!a.c' >> .gitignore\n$ touch a.c b.c\n$ git check-ignore a.c b.c\na.c\nb.c\n$ git add *.c\nThe following paths are ignored by one of your .gitignore files:\nb.c\nUse -f if you really want to add them.\n$ git check-ignore a.c b.c\nb.c\n$ git check-ignore --no-index a.c b.c\na.c\nb.c\n$ git check-ignore --no-index --verbose a.c b.c\n.gitignore:2:!a.c       a.c\n.gitignore:1:*.c        b.c\n\nIn looking through check-ignore.c, it appears that we check that\nlast_exclude_matching() returns an exclude object. It should be noted\nthat we do not consider that exclude struct can be set with the\nEXC_FLAG_NEGATIVE flag. This flag says that the final matching rule\nshould not be ignored.\ncheck_ignore needs to consider this condition in order to work properly.\n"},{"id":"358604","messageId":"CACsJy8Cn-SyY6E8O3ttmr8k2vJ+8gGoN+NFmUSD71yiC1t552w@mail.gmail.com","threadId":"49392","inReplyTo":"CAB=bJ9Mjw2keJ3aspLWcreLBcB15Eq-WjtBO0XS8B=C3XJmx9A@mail.gmail.com","subject":"Re: git check-ignore ignores negated entries","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2018-09-21T16:13:10Z","receivedAt":"2018-09-21T16:13:39Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Thu, Sep 20, 2018 at 7:25 PM David Alphus <david.alphus@gmail.com> wrote:\n> In looking through check-ignore.c, it appears that we check that\n> last_exclude_matching() returns an exclude object. It should be noted\n> that we do not consider that exclude struct can be set with the\n> EXC_FLAG_NEGATIVE flag. This flag says that the final matching rule\n> should not be ignored.\n> check_ignore needs to consider this condition in order to work properly.\n\nI haven't checked the code yet. But since you already did, patches are\nwelcome ;-)\n-- \nDuy\n"}]}