{"thread":{"id":"27451","subject":"Supporting \"-v\" option for git-log","startedAt":"2011-05-25T09:40:48Z","lastAt":"2011-05-25T20:01:36Z","messageCount":14,"participants":["Elazar Leibovich","Tim Mazid","Jeff King","Jakub Narebski","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"168632","messageId":"BANLkTik70gu0NUzUEnGNWHQr8CfbdPVe5g@mail.gmail.com","threadId":"27451","inReplyTo":null,"subject":"Supporting \"-v\" option for git-log","fromName":"Elazar Leibovich","fromEmail":"elazarl@gmail.com","sentAt":"2011-05-25T09:40:48Z","receivedAt":"2011-05-25T09:40:48Z","isPatch":false,"sender":{"key":"elazarl@gmail.com","avatar":null},"body":"I want to use git log to show all commits that do not match a given\npattern. I know I can use the following to show all commits that do\nmatch a pattern, similar to the \"grep -v\" command line option:\n\n    git log -v --grep=<pattern> # results all commits that do NOT match pattern\n\nIs there a way invert the sense of matching?\n\nIf not, is it OK to submit a patch? Anything to consider for this patch?\n\n\n[*] x-post from here\nhttp://stackoverflow.com/questions/5602204/how-to-invert-git-log-grep-pattern-or-how-to-show-git-logs-that-dont-match\n"},{"id":"168636","messageId":"SNT124-W39164C74A457129811245DC4740@phx.gbl","threadId":"27451","inReplyTo":"BANLkTik70gu0NUzUEnGNWHQr8CfbdPVe5g@mail.gmail.com","subject":"RE: Supporting \"-v\" option for git-log","fromName":"Tim Mazid","fromEmail":"timmazid@hotmail.com","sentAt":"2011-05-25T11:05:49Z","receivedAt":"2011-05-25T11:05:49Z","isPatch":false,"sender":{"key":"timmazid@hotmail.com","avatar":null},"body":"\n> Date: Wed, 25 May 2011 12:40:48 +0300\n> From: elazarl@gmail.com\n>\n> I want to use git log to show all commits that do not match a given\n> pattern. I know I can use the following to show all commits that do\n> match a pattern, similar to the \"grep -v\" command line option:\n>\n> git log -v --grep= # results all commits that do NOT match pattern\n>\n> Is there a way invert the sense of matching?\n>\n> If not, is it OK to submit a patch? Anything to consider for this patch?\n\nI'm confused; do you want to find all the commits that do not match a\npattern? Because you seem to have achieved that. If, on the other hand,\nyou want the commits that DO match a pattern, then just leave out the\n\"-v\" option.\n\nWhat exactly are you trying to achieve?\n\n\nTim.\n\n() ascii ribbon campaign - against html e-mail\n/\\ www.asciiribbon.org - against proprietary attachments\n \t\t \t   \t\t  "},{"id":"168637","messageId":"BANLkTi=v8j=VdBNgThRTFXk+YbPFOFvzwQ@mail.gmail.com","threadId":"27451","inReplyTo":"SNT124-W39164C74A457129811245DC4740@phx.gbl","subject":"Re: Supporting \"-v\" option for git-log","fromName":"Elazar Leibovich","fromEmail":"elazarl@gmail.com","sentAt":"2011-05-25T11:14:01Z","receivedAt":"2011-05-25T11:14:01Z","isPatch":false,"sender":{"key":"elazarl@gmail.com","avatar":null},"body":"On Wed, May 25, 2011 at 2:05 PM, Tim Mazid <timmazid@hotmail.com> wrote:\n>\n>> Date: Wed, 25 May 2011 12:40:48 +0300\n>> From: elazarl@gmail.com\n>> git log -v --grep= # results all commits that do NOT match pattern\n>>\n>> Is there a way invert the sense of matching?\n>>\n> I'm confused; do you want to find all the commits that do not match a\n> pattern? Because you seem to have achieved that. If, on the other hand,\n> you want the commits that DO match a pattern, then just leave out the\n> \"-v\" option.\n>\n> What exactly are you trying to achieve?\n\nOops, let me be 100% clear about that, \"git log -v\n--grep==<pattern_not_to_match\" is NOT WORKING currently. I just\npresented a possible syntax.\n\n$ git --version\ngit version 1.7.4.msysgit.0\n$ git log -v --grep=Normalized\ncommit 88c7a82aaf240ed130c64c455c294e7af04d30f8\nAuthor: Elazar <elazarl@gmail.com>\nDate:   Mon May 16 10:40:21 2011 +0300\n\n    Normalized Makfile so that it'll work by default. Include Makefile\n\nsee, it ignores the \"-v\", and include only commits with \"Normalized\" -\nthe ones I don't want to see.\n"},{"id":"168638","messageId":"SNT124-W5207D5461CD80509763B79C4740@phx.gbl","threadId":"27451","inReplyTo":"BANLkTi=v8j=VdBNgThRTFXk+YbPFOFvzwQ@mail.gmail.com","subject":"RE: Supporting \"-v\" option for git-log","fromName":"Tim Mazid","fromEmail":"timmazid@hotmail.com","sentAt":"2011-05-25T11:21:12Z","receivedAt":"2011-05-25T11:21:12Z","isPatch":false,"sender":{"key":"timmazid@hotmail.com","avatar":null},"body":"\n> From: elazarl@gmail.com\n> Oops, let me be 100% clear about that, \"git log -v\n> --grep==> presented a possible syntax.\n>\n> $ git --version\n> git version 1.7.4.msysgit.0\n> $ git log -v --grep=Normalized\n> commit 88c7a82aaf240ed130c64c455c294e7af04d30f8\n> Author: Elazar \n> Date: Mon May 16 10:40:21 2011 +0300\n>\n> Normalized Makfile so that it'll work by default. Include Makefile\n>\n> see, it ignores the \"-v\", and include only commits with \"Normalized\" -\n> the ones I don't want to see.\n\nAh, I see; my apologies.\n\nWell, personally, I've never used the --grep option. I pipe it through\ngrep, where I can supply options such as -v. However, if the --grep\noption already exists, then it does make sense to allow users to use\noptions they would normally be able to with grep.\n\nAs for the syntax, that seems like a good idea on the surface, but\nhow would you go about supporting other grep options? Such as\n\"-i\"?\n\n\nTim.\n\n() ascii ribbon campaign - against html e-mail\n/\\ www.asciiribbon.org - against proprietary attachments\n \t\t \t   \t\t  "},{"id":"168639","messageId":"SNT124-W631EA986B78300D93BF669C4740@phx.gbl","threadId":"27451","inReplyTo":"SNT124-W5207D5461CD80509763B79C4740@phx.gbl","subject":"RE: Supporting \"-v\" option for git-log","fromName":"Tim Mazid","fromEmail":"timmazid@hotmail.com","sentAt":"2011-05-25T11:24:11Z","receivedAt":"2011-05-25T11:24:11Z","isPatch":false,"sender":{"key":"timmazid@hotmail.com","avatar":null},"body":"\n> From: timmazid@hotmail.com\n> > From: elazarl@gmail.com\n> > Oops, let me be 100% clear about that, \"git log -v\n> > --grep==> presented a possible syntax.\n> >\n> > $ git --version\n> > git version 1.7.4.msysgit.0\n> > $ git log -v --grep=Normalized\n> > commit 88c7a82aaf240ed130c64c455c294e7af04d30f8\n> > Author: Elazar\n> > Date: Mon May 16 10:40:21 2011 +0300\n> >\n> > Normalized Makfile so that it'll work by default. Include Makefile\n> >\n> > see, it ignores the \"-v\", and include only commits with \"Normalized\" -\n> > the ones I don't want to see.\n>\n> Ah, I see; my apologies.\n>\n> Well, personally, I've never used the --grep option. I pipe it through\n> grep, where I can supply options such as -v. However, if the --grep\n> option already exists, then it does make sense to allow users to use\n> options they would normally be able to with grep.\n>\n> As for the syntax, that seems like a good idea on the surface, but\n> how would you go about supporting other grep options? Such as\n> \"-i\"?\n\nWoops; my bad; \"-i\" is already supported. But the point still stands...\nI think?\n\nShould there be a seperate \"--grep-options\" option for \"git log\" to\npass options onto grep?\n\n Tim.\n\n() ascii ribbon campaign - against html e-mail\n/\\ www.asciiribbon.org    - against proprietary attachments\n \t\t \t   \t\t  "},{"id":"168640","messageId":"BANLkTikT4s+Twfip2g7Zo-XcML1Wbd3qBg@mail.gmail.com","threadId":"27451","inReplyTo":"SNT124-W5207D5461CD80509763B79C4740@phx.gbl","subject":"Re: Supporting \"-v\" option for git-log","fromName":"Elazar Leibovich","fromEmail":"elazarl@gmail.com","sentAt":"2011-05-25T11:28:12Z","receivedAt":"2011-05-25T11:28:12Z","isPatch":false,"sender":{"key":"elazarl@gmail.com","avatar":null},"body":"On Wed, May 25, 2011 at 2:21 PM, Tim Mazid <timmazid@hotmail.com> wrote:\n>\n> Well, personally, I've never used the --grep option. I pipe it through\n> grep, where I can supply options such as -v.\n\nBut then you must use single-line commits output. Which is\ninconvenient if you want to read all the commit message.\n\n> However, if the --grep\n> option already exists, then it does make sense to allow users to use\n> options they would normally be able to with grep.\n>\n> As for the syntax, that seems like a good idea on the surface, but\n> how would you go about supporting other grep options? Such as\n> \"-i\"?\n\nNow that I think of it, we already have the '--not' option for\nrevision specifiers. Why won't we use it for grep patterns? That way\n-v will not be overloaded (it usually means verbose). For example\n\n    git log --all --not --grep A --grep B\n\nWould mean find all commits without A and with B, in SQL \"SELECT *\nFROM COMMITS WHERE message NOT LIKE '%A%'  AND message LIKE '%B%'\".\n"},{"id":"168641","messageId":"SNT124-W15FA6D1CACA43B253810FAC4740@phx.gbl","threadId":"27451","inReplyTo":"BANLkTikT4s+Twfip2g7Zo-XcML1Wbd3qBg@mail.gmail.com","subject":"RE: Supporting \"-v\" option for git-log","fromName":"Tim Mazid","fromEmail":"timmazid@hotmail.com","sentAt":"2011-05-25T11:35:12Z","receivedAt":"2011-05-25T11:35:12Z","isPatch":false,"sender":{"key":"timmazid@hotmail.com","avatar":null},"body":"\n> Date: Wed, 25 May 2011 14:28:12 +0300\n> From: elazarl@gmail.com\n> On Wed, May 25, 2011 at 2:21 PM, Tim Mazid  wrote:\n> >\n> > Well, personally, I've never used the --grep option. I pipe it through\n> > grep, where I can supply options such as -v.\n>\n> But then you must use single-line commits output. Which is\n> inconvenient if you want to read all the commit message.\n\nThat is a good point.\n\n\n> > As for the syntax, that seems like a good idea on the surface, but\n> > how would you go about supporting other grep options? Such as\n> > \"-i\"?\n>\n> Now that I think of it, we already have the '--not' option for\n> revision specifiers. Why won't we use it for grep patterns? That way\n> -v will not be overloaded (it usually means verbose). For example\n>\n> git log --all --not --grep A --grep B\n>\n> Would mean find all commits without A and with B, in SQL \"SELECT *\n> FROM COMMITS WHERE message NOT LIKE '%A%' AND message LIKE '%B%'\".\n\nBut how do you know which \"--grep\" the \"--not\" applies to? Does it have \nto go directly before the \"--grep\" option? Can it be a few options before\nas long is it's still before? If you want to find commits not matching two\npatterns, do you have to do \"--not --grep A --not --grep B\"?\n\nI can see this as being a possible source of confusion; people doing\n\"--not grep A --grep B\" and expecting it to mean NOT A AND NOT B.\n\n\nTim.\n\n() ascii ribbon campaign - against html e-mail\n/\\ www.asciiribbon.org - against proprietary attachments\n \t\t \t   \t\t  "},{"id":"168642","messageId":"BANLkTimWymFNC7hP=X2w0RMwdLPjGC07Aw@mail.gmail.com","threadId":"27451","inReplyTo":"SNT124-W15FA6D1CACA43B253810FAC4740@phx.gbl","subject":"Re: Supporting \"-v\" option for git-log","fromName":"Elazar Leibovich","fromEmail":"elazarl@gmail.com","sentAt":"2011-05-25T11:40:19Z","receivedAt":"2011-05-25T11:40:19Z","isPatch":false,"sender":{"key":"elazarl@gmail.com","avatar":null},"body":"On Wed, May 25, 2011 at 2:35 PM, Tim Mazid <timmazid@hotmail.com> wrote:\n>\n>> git log --all --not --grep A --grep B\n>>\n>> Would mean find all commits without A and with B, in SQL \"SELECT *\n>> FROM COMMITS WHERE message NOT LIKE '%A%' AND message LIKE '%B%'\".\n>\n> But how do you know which \"--grep\" the \"--not\" applies to? Does it have\n> to go directly before the \"--grep\" option?\n\nExactly, just like the ! operator in C.\n\n> Can it be a few options before\n> as long is it's still before?\n\nNo, only directly before the --grep, like the ! operator.\n\n> If you want to find commits not matching two\n> patterns, do you have to do \"--not --grep A --not --grep B\"?\n\nYes, we can add a --negate-all option if you think it's usefull.\n\n>\n> I can see this as being a possible source of confusion; people doing\n> \"--not grep A --grep B\" and expecting it to mean NOT A AND NOT B.\n\nYou can add another option --negate which negates everything. But this\nis a price to pay for being extra expressive.\n"},{"id":"168645","messageId":"20110525132816.GA6709@sigill.intra.peff.net","threadId":"27451","inReplyTo":"BANLkTikT4s+Twfip2g7Zo-XcML1Wbd3qBg@mail.gmail.com","subject":"Re: Supporting \"-v\" option for git-log","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-05-25T13:29:44Z","receivedAt":"2011-05-25T13:29:44Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, May 25, 2011 at 02:28:12PM +0300, Elazar Leibovich wrote:\n\n> On Wed, May 25, 2011 at 2:21 PM, Tim Mazid <timmazid@hotmail.com> wrote:\n> >\n> > Well, personally, I've never used the --grep option. I pipe it through\n> > grep, where I can supply options such as -v.\n> \n> But then you must use single-line commits output. Which is\n> inconvenient if you want to read all the commit message.\n\nYou can use perl to consider records larger than a single line, like:\n\n  git log -z | perl -ln0e 'print unless /your pattern/'\n\nBut of course that is somewhat inconvenient to type, and is somewhat\nslower than the internal grep.\n\n> Now that I think of it, we already have the '--not' option for\n> revision specifiers. Why won't we use it for grep patterns? That way\n> -v will not be overloaded (it usually means verbose). For example\n> \n>     git log --all --not --grep A --grep B\n\nThe problem is that \"--not\" already has a meaning, and the scope of that\nmeaning is different than what you propose. That is, in this command:\n\n  git log a --not b c\n\nThe \"--not\" applies to both \"b\" and \"c\". So you are changing the meaning\nof the existing:\n\n  git log a --not --grep b c\n\n(which now means \"grep for b, but do not include commits in c\"). And\neven if we wanted to do that, there is a parsing ambiguity. Does the\n\"--not\" apply _just_ to the grep, or does it also include \"not c\"?\n\nWhich is a shame, because we already have all of the code for \"--and\",\n\"--or\", and \"--not\" in git-grep. It is just a syntactic conflict. I\nthink you could get away with \"--grep-and\", \"--grep-or\", and\n\"--grep-not\". They are obviously less nice to type, but there would be\nnot conflict.\n\n-Peff\n"},{"id":"168646","messageId":"m3boyqzy3f.fsf@localhost.localdomain","threadId":"27451","inReplyTo":"20110525132816.GA6709@sigill.intra.peff.net","subject":"Re: Supporting \"-v\" option for git-log","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2011-05-25T13:53:31Z","receivedAt":"2011-05-25T13:53:31Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Jeff King <peff@peff.net> writes:\n> On Wed, May 25, 2011 at 02:28:12PM +0300, Elazar Leibovich wrote:\n\n[...]\n> > Now that I think of it, we already have the '--not' option for\n> > revision specifiers. Why won't we use it for grep patterns? That way\n> > -v will not be overloaded (it usually means verbose). For example\n> > \n> >     git log --all --not --grep A --grep B\n> \n> The problem is that \"--not\" already has a meaning, and the scope of that\n> meaning is different than what you propose. That is, in this command:\n> \n>   git log a --not b c\n> \n> The \"--not\" applies to both \"b\" and \"c\". So you are changing the meaning\n> of the existing:\n> \n>   git log a --not --grep b c\n> \n> (which now means \"grep for b, but do not include commits in c\"). And\n> even if we wanted to do that, there is a parsing ambiguity. Does the\n> \"--not\" apply _just_ to the grep, or does it also include \"not c\"?\n> \n> Which is a shame, because we already have all of the code for \"--and\",\n> \"--or\", and \"--not\" in git-grep. It is just a syntactic conflict. I\n> think you could get away with \"--grep-and\", \"--grep-or\", and\n> \"--grep-not\". They are obviously less nice to type, but there would be\n> not conflict.\n\nHmmm... perhaps short -! could be alias for --grep-not (it is the only\nthat needs to be changed to avoid conflict, as there are no --or and\n--and for rev-list).\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"168666","messageId":"20110525151115.GB8795@sigill.intra.peff.net","threadId":"27451","inReplyTo":"m3boyqzy3f.fsf@localhost.localdomain","subject":"Re: Supporting \"-v\" option for git-log","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-05-25T15:11:15Z","receivedAt":"2011-05-25T15:11:15Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, May 25, 2011 at 06:53:31AM -0700, Jakub Narebski wrote:\n\n> > Which is a shame, because we already have all of the code for \"--and\",\n> > \"--or\", and \"--not\" in git-grep. It is just a syntactic conflict. I\n> > think you could get away with \"--grep-and\", \"--grep-or\", and\n> > \"--grep-not\". They are obviously less nice to type, but there would be\n> > not conflict.\n> \n> Hmmm... perhaps short -! could be alias for --grep-not (it is the only\n> that needs to be changed to avoid conflict, as there are no --or and\n> --and for rev-list).\n\nIck. I really hate using shell metacharacters that need quoting\n(especially \"!\", which even gets expanded inside double-quotes). But as\nlong as it's an alias, I guess people who care can use --grep-not.\n\nWe could use unadorned \"--or\" and \"--and\", though we should perhaps stop\nand think whether taking those basic operators will block future use\nthat matches the current \"--not\" more.\n\nRight now, \"git log a b\" is what I would expect \"git log a --or b\" to\ndo. I guess \"git log a --and b\" would be \"git log $(git merge-base a\nb)\". So maybe it is not worth reserving them for the future, since what\nthey would (probably) accomplish is easy to do now.\n\n-Peff\n"},{"id":"168681","messageId":"201105251838.59548.jnareb@gmail.com","threadId":"27451","inReplyTo":"20110525151115.GB8795@sigill.intra.peff.net","subject":"Re: Supporting \"-v\" option for git-log","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2011-05-25T16:38:58Z","receivedAt":"2011-05-25T16:38:58Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Dnia środa 25. maja 2011 17:11, Jeff King napisał:\n> On Wed, May 25, 2011 at 06:53:31AM -0700, Jakub Narebski wrote:\n> \n> > > Which is a shame, because we already have all of the code for \"--and\",\n> > > \"--or\", and \"--not\" in git-grep. It is just a syntactic conflict. I\n> > > think you could get away with \"--grep-and\", \"--grep-or\", and\n> > > \"--grep-not\". They are obviously less nice to type, but there would be\n> > > not conflict.\n> > \n> > Hmmm... perhaps short -! could be alias for --grep-not (it is the only\n> > that needs to be changed to avoid conflict, as there are no --or and\n> > --and for rev-list).\n> \n> Ick. I really hate using shell metacharacters that need quoting\n> (especially \"!\", which even gets expanded inside double-quotes). But as\n> long as it's an alias, I guess people who care can use --grep-not.\n\nYeah, I know.  Nevertheless '!' is natural to mean 'not', \nand `-\\!` is still shorter than `--grep-not`.\n \n-- \nJakub Narebski\nPoland\n"},{"id":"168690","messageId":"7vlixu4reu.fsf@alter.siamese.dyndns.org","threadId":"27451","inReplyTo":"20110525132816.GA6709@sigill.intra.peff.net","subject":"Re: Supporting \"-v\" option for git-log","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-05-25T17:32:41Z","receivedAt":"2011-05-25T17:32:41Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> The problem is that \"--not\" already has a meaning, and the scope of that\n> meaning is different than what you propose. That is, in this command:\n>\n>   git log a --not b c\n>\n> The \"--not\" applies to both \"b\" and \"c\". So you are changing the meaning\n> of the existing:\n>\n>   git log a --not --grep b c\n>\n> (which now means \"grep for b, but do not include commits in c\"). And\n> even if we wanted to do that, there is a parsing ambiguity. Does the\n> \"--not\" apply _just_ to the grep, or does it also include \"not c\"?\n>\n> Which is a shame, because we already have all of the code for \"--and\",\n> \"--or\", and \"--not\" in git-grep.\n\nTrue, that has always been an accepted limitation.\n\nYou could add --grep=\"-e A --and --not -e B --all-match\", split_cmdline()\nand then give the result to append_grep_pattern(), or something like that,\nbut I do not think it is worth doing.\n"},{"id":"168710","messageId":"20110525200136.GD27260@sigill.intra.peff.net","threadId":"27451","inReplyTo":"7vlixu4reu.fsf@alter.siamese.dyndns.org","subject":"Re: Supporting \"-v\" option for git-log","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-05-25T20:01:36Z","receivedAt":"2011-05-25T20:01:36Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, May 25, 2011 at 10:32:41AM -0700, Junio C Hamano wrote:\n\n> > (which now means \"grep for b, but do not include commits in c\"). And\n> > even if we wanted to do that, there is a parsing ambiguity. Does the\n> > \"--not\" apply _just_ to the grep, or does it also include \"not c\"?\n> >\n> > Which is a shame, because we already have all of the code for \"--and\",\n> > \"--or\", and \"--not\" in git-grep.\n> \n> True, that has always been an accepted limitation.\n> \n> You could add --grep=\"-e A --and --not -e B --all-match\", split_cmdline()\n> and then give the result to append_grep_pattern(), or something like that,\n> but I do not think it is worth doing.\n\nBesides being ambiguous with current usage (e.g., grepping for something\nstarting with \"-e\"), I do not long for the quoting nightmare of:\n\n  git log --grep=\"-e 'something with spaces'\n      --and --not -e 'something with \\\"double quotes\\\"'\n      --and --not -e 'something with '\\\\''single quotes'\\\\''\"\n\n-Peff\n"}]}