{"thread":{"id":"42834","subject":"Bug report: --invert-grep and --author seems to be incompatible.","startedAt":"2016-07-13T16:54:39Z","lastAt":"2016-07-13T20:33:28Z","messageCount":6,"participants":["Jehan Pagès","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"291362","messageId":"CAFgjPJ-E0k8KQjdcRki4Qr1tPjwfJVtuFWOKYV-+f6POgb-=wg@mail.gmail.com","threadId":"42834","inReplyTo":null,"subject":"Bug report: --invert-grep and --author seems to be incompatible.","fromName":"Jehan Pagès","fromEmail":"jehan.marmottard@gmail.com","sentAt":"2016-07-13T16:52:48Z","receivedAt":"2016-07-13T16:54:39Z","isPatch":false,"sender":{"key":"jehan.marmottard@gmail.com","avatar":"https://gravatar.com/avatar/56877beb3b0b977b6f1afaf76cf3e6916833e62cffc65768028e1c7ff570bdf8?d=mp&s=160"},"body":"Hello,\n\n> $ git version\n> git version 2.5.5\n\nTested on a Fedora 23.\n\nYou can combine `git log --author=someone --grep=something` to have\nall commits by \"someone\" where \"something\" can be grepped. If I want\nall commits by someone where \"something\" is not grepped, I would\nexpect this command to return it:\n\n> git log --author=someone --invert-grep --grep=something\n\nBut it does not work. Actually it looks like it just returns\neverything (as though I had done a simple `git log`). So there seems\nto be a problem here.\nThanks!\n\nJehan\n\n-- \nZeMarmot open animation film\nhttp://film.zemarmot.net\nPatreon: https://patreon.com/zemarmot\nTipeee: https://www.tipeee.com/zemarmot\n"},{"id":"291364","messageId":"xmqqtwft1nbi.fsf@gitster.mtv.corp.google.com","threadId":"42834","inReplyTo":"CAFgjPJ-E0k8KQjdcRki4Qr1tPjwfJVtuFWOKYV-+f6POgb-=wg@mail.gmail.com","subject":"Re: Bug report: --invert-grep and --author seems to be incompatible.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-07-13T17:04:49Z","receivedAt":"2016-07-13T17:05:32Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jehan Pagès <jehan.marmottard@gmail.com> writes:\n\n>> git log --author=someone --invert-grep --grep=something\n>\n> But it does not work. Actually it looks like it just returns\n> everything (as though I had done a simple `git log`).\n\nDo you see a commit that is by \"someone\" and has \"something\" in it\nin the output from the command?\n\nI think --author=someone greps the \"author \" field in the commit\nobject looking for the hit with \"someone\", and your request asks to\nshow commits that either do not have \"something\" or was not written\nby \"someone\", I would guess.\n\n"},{"id":"291365","messageId":"CAFgjPJ-E=eW_ZiAUf2jKu6z3WfW_p+BMbEJwf=OSGUXQB78kwQ@mail.gmail.com","threadId":"42834","inReplyTo":"xmqqtwft1nbi.fsf@gitster.mtv.corp.google.com","subject":"Re: Bug report: --invert-grep and --author seems to be incompatible.","fromName":"Jehan Pagès","fromEmail":"jehan.marmottard@gmail.com","sentAt":"2016-07-13T17:16:31Z","receivedAt":"2016-07-13T17:18:05Z","isPatch":false,"sender":{"key":"jehan.marmottard@gmail.com","avatar":"https://gravatar.com/avatar/56877beb3b0b977b6f1afaf76cf3e6916833e62cffc65768028e1c7ff570bdf8?d=mp&s=160"},"body":"Hi,\n\nOn Wed, Jul 13, 2016 at 7:04 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Jehan Pagès <jehan.marmottard@gmail.com> writes:\n>\n>>> git log --author=someone --invert-grep --grep=something\n>>\n>> But it does not work. Actually it looks like it just returns\n>> everything (as though I had done a simple `git log`).\n>\n> Do you see a commit that is by \"someone\" and has \"something\" in it\n> in the output from the command?\n\nIndeed you are right! Commits which are by \"someone\" and have\n\"something\" in it in the same time are missing.\nSo here --invert-grep works as a big \"NOT\" operator on the whole rest\nof the command line, which is not expected (at least by me).\n\n> I think --author=someone greps the \"author \" field in the commit\n> object looking for the hit with \"someone\", and your request asks to\n> show commits that either do not have \"something\" or was not written\n> by \"someone\", I would guess.\n\nNote that I can still see commits with \"something\", and I can also see\ncommits by \"someone\" in my results. So my request actually ask for\ncommits which have neither \"something\" nor are done by \"someone\".\n\nAnyway I don't think that's the expected result, hence is still a bug.\nAm I wrong?\n\nJehan\n\n-- \nZeMarmot open animation film\nhttp://film.zemarmot.net\nPatreon: https://patreon.com/zemarmot\nTipeee: https://www.tipeee.com/zemarmot\n"},{"id":"291368","messageId":"xmqqlh151lst.fsf@gitster.mtv.corp.google.com","threadId":"42834","inReplyTo":"CAFgjPJ-E=eW_ZiAUf2jKu6z3WfW_p+BMbEJwf=OSGUXQB78kwQ@mail.gmail.com","subject":"Re: Bug report: --invert-grep and --author seems to be incompatible.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-07-13T17:37:38Z","receivedAt":"2016-07-13T17:38:55Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jehan Pagès <jehan.marmottard@gmail.com> writes:\n\n>> I think --author=someone greps the \"author \" field in the commit\n>> object looking for the hit with \"someone\", and your request asks to\n>> show commits that either do not have \"something\" or was not written\n>> by \"someone\", I would guess.\n>\n> Note that I can still see commits with \"something\", and I can also see\n> commits by \"someone\" in my results. So my request actually ask for\n> commits which have neither \"something\" nor are done by \"someone\".\n>\n> Anyway I don't think that's the expected result, hence is still a bug.\n> Am I wrong?\n\nUnlike \"git grep\", \"git log\" works with boolean expression that does\nnot explicitly have a way to say \"--and\" and \"--or\", so only one\ninterpretation has been chosen long time ago.  All the terms are\nORed together, and then the whole thing can be inverted with\n\"--invert-grep\".  i.e. you are telling an equivalent of\n\n    $ git grep --not \\( -e \"author someone\" --or -e \"something\" \\)\n\nwith the command line, and there is no way to combine the requested\nmatch criteria (there are two, \"author must be somebody\" and\n\"something must be in the message\") differently.\n\nGiven that, that is the \"right\" expectation, and as long as you get\nthe behaviour, there is no \"bug\".\n\nYou can call it a lack of feature, though, and patches to implement\na more flexible combination of match criteria like \"git grep\" allows\nis always welcome.\n"},{"id":"291390","messageId":"CAFgjPJ_er6QCaYenU=10_935HoKbc=8hqbJku5p6kF2BYkSrjw@mail.gmail.com","threadId":"42834","inReplyTo":"xmqqlh151lst.fsf@gitster.mtv.corp.google.com","subject":"Re: Bug report: --invert-grep and --author seems to be incompatible.","fromName":"Jehan Pagès","fromEmail":"jehan.marmottard@gmail.com","sentAt":"2016-07-13T20:14:09Z","receivedAt":"2016-07-13T20:14:49Z","isPatch":false,"sender":{"key":"jehan.marmottard@gmail.com","avatar":"https://gravatar.com/avatar/56877beb3b0b977b6f1afaf76cf3e6916833e62cffc65768028e1c7ff570bdf8?d=mp&s=160"},"body":"Hi,\n\nOn Wed, Jul 13, 2016 at 7:37 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Jehan Pagès <jehan.marmottard@gmail.com> writes:\n>\n>>> I think --author=someone greps the \"author \" field in the commit\n>>> object looking for the hit with \"someone\", and your request asks to\n>>> show commits that either do not have \"something\" or was not written\n>>> by \"someone\", I would guess.\n>>\n>> Note that I can still see commits with \"something\", and I can also see\n>> commits by \"someone\" in my results. So my request actually ask for\n>> commits which have neither \"something\" nor are done by \"someone\".\n>>\n>> Anyway I don't think that's the expected result, hence is still a bug.\n>> Am I wrong?\n>\n> Unlike \"git grep\", \"git log\" works with boolean expression that does\n> not explicitly have a way to say \"--and\" and \"--or\", so only one\n> interpretation has been chosen long time ago.  All the terms are\n> ORed together, and then the whole thing can be inverted with\n> \"--invert-grep\".  i.e. you are telling an equivalent of\n>\n>     $ git grep --not \\( -e \"author someone\" --or -e \"something\" \\)\n>\n> with the command line, and there is no way to combine the requested\n> match criteria (there are two, \"author must be somebody\" and\n> \"something must be in the message\") differently.\n>\n> Given that, that is the \"right\" expectation, and as long as you get\n> the behaviour, there is no \"bug\".\n\nI see. Well it's a little counter-intuitive though, since the option\nis called --invert-grep. And the man indicates:\n\n« Limit the commits output to ones with log message that do not match\nthe pattern specified with --grep=<pattern>. »\n\nSo it gives the impression that the option is made only to invert the\n--grep part. Whereas in fact, you are saying it inverts any other\noptional selection (or at least also --author). A better naming should\nhave been called --invert-matches, or even just --invert.\nAnd the man description should definitely be completed, IMO.\n\n> You can call it a lack of feature, though, and patches to implement\n> a more flexible combination of match criteria like \"git grep\" allows\n> is always welcome.\n\nMaybe I will! This would be useful to have a little more capabilities\nfor commit selection.\nThanks.\n\nJehan\n\n-- \nZeMarmot open animation film\nhttp://film.zemarmot.net\nPatreon: https://patreon.com/zemarmot\nTipeee: https://www.tipeee.com/zemarmot\n"},{"id":"291391","messageId":"xmqqr3axz3b3.fsf@gitster.mtv.corp.google.com","threadId":"42834","inReplyTo":"CAFgjPJ_er6QCaYenU=10_935HoKbc=8hqbJku5p6kF2BYkSrjw@mail.gmail.com","subject":"Re: Bug report: --invert-grep and --author seems to be incompatible.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-07-13T20:33:04Z","receivedAt":"2016-07-13T20:33:28Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jehan Pagès <jehan.marmottard@gmail.com> writes:\n\n> ... A better naming should\n> have been called --invert-matches, or even just --invert.\n> And the man description should definitely be completed, IMO.\n\nRenaming the options would not work well without harming existing\nusers, but a patch to update the documentation is certainly very\nwelcome.\n"}]}