{"thread":{"id":"16174","subject":"git log -S doesn't find some commits","startedAt":"2008-11-04T22:59:40Z","lastAt":"2008-11-05T01:30:20Z","messageCount":7,"participants":["Bernt Hansen","Pieter de Bie","Johannes Schindelin","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"94927","messageId":"87fxm7rtb7.fsf@gollum.intra.norang.ca","threadId":"16174","inReplyTo":null,"subject":"git log -S doesn't find some commits","fromName":"Bernt Hansen","fromEmail":"bernt@norang.ca","sentAt":"2008-11-04T22:59:40Z","receivedAt":"2008-11-04T22:59:40Z","isPatch":false,"sender":{"key":"bernt@norang.ca","avatar":null},"body":"Hi!\n\nThe org-mode repository at git://repo.or.cz/org-mode.git has history\nthat looks like this:\n\n\n                  o--o--o--o-------------------M--F--o-- .. --o master\n                 /                            /\n A--o-- .. --o--o-------------o--o--B--C--X--D\n\n\nwhere commits A, B, C, D, and F all modify lines with\n'org-publish-validate-link'.  M is a merge commit and X has an empty log\nmessage.\n\n$ git checkout 8ea076e2de2b3721bd813ea5a2df1b53d0c25055 # commit F\n$ git log -Sorg-publish-validate-link\n\nreports 3 commits\n\nF, A, and something earlier than A\n\nCommits B, C, and D are not included in the git log -S output even\nthough with gitk you can see that 'org-publish-validate-link' is in the\npatch.\n\nAm I doing something wrong or is this a bug?\n\n$ git --version\ngit version 1.6.0.3.523.g304d0\n\nI've marked the commits in column one below.\n\n  $ git log --pretty=oneline\n\nF 8ea076e2de2b3721bd813ea5a2df1b53d0c25055 Updated org-publish.el (now version 1.8\n  e322abfd14267a154a06deb1e7ef5a432b17f68a Merge branch 'add-recursion-to-org-publ\n  6208fb43cb1bbab852560cf506c7d12674307492 Minor docstring fix.\n  df54646ab324b11e99279dc0b6dfa161a1c72c7d Fixed the Timeline node.\nD 4dcecb97bf4586c26f7e955980caa7e9630ae9a7 More cleaning.\nX eda5a993cab01acd6878ab6c982b075d2cba167b *** empty log message ***\nC b05bc10e6794c902df679b906d8bd6ec3f5633a9 Cleaned up code.\nB 837c81ce51d90427bbcc32b06d84505b1a1e6b2a Use alist instead of a hashtable.\n  960449c9e93725f791bd450d3c85fd71339efb09 Cleaned up the buffer.\n  bf09955fec57307616926959b31e19af42520db0 Bugfix for `org-archive-subtree'.\n  f247d16417f17140a5bd5d03db164cc74191d9c1 Added support for :maxlevel and :skip-e\n  bd172412fafaa0386762826677f9929c9c4fc41c Added support for recursive publication\n  96e96fa684585e9916f4d6cdde20d4df7ff3f7d7 Added (require 'erc-log).\n\nThanks for git!\nBernt\n"},{"id":"94928","messageId":"0A948471-7FAA-489A-A86C-D014C6E4C8C9@ai.rug.nl","threadId":"16174","inReplyTo":"87fxm7rtb7.fsf@gollum.intra.norang.ca","subject":"Re: git log -S doesn't find some commits","fromName":"Pieter de Bie","fromEmail":"pdebie@ai.rug.nl","sentAt":"2008-11-04T23:06:42Z","receivedAt":"2008-11-04T23:06:42Z","isPatch":false,"sender":{"key":"pdebie@ai.rug.nl","avatar":null},"body":"\nOn Nov 4, 2008, at 11:59 PM, Bernt Hansen wrote:\n\n>                  o--o--o--o-------------------M--F--o-- .. --o master\n>                 /                            /\n> A--o-- .. --o--o-------------o--o--B--C--X--D\n>\n>\n> where commits A, B, C, D, and F all modify lines with\n> 'org-publish-validate-link'.  M is a merge commit and X has an empty  \n> log\n> message.\n>\n> $ git checkout 8ea076e2de2b3721bd813ea5a2df1b53d0c25055 # commit F\n> $ git log -Sorg-publish-validate-link\n\nB,C,X and D are not part of 'F', so why should they be included?\n\nYou can do something like 'git log -S... F D' to show commits that are  \nalso in D, or git log --all to show all commits.\n"},{"id":"94929","messageId":"alpine.DEB.1.00.0811050014310.30769@pacific.mpi-cbg.de","threadId":"16174","inReplyTo":"87fxm7rtb7.fsf@gollum.intra.norang.ca","subject":"Re: git log -S doesn't find some commits","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-11-04T23:15:44Z","receivedAt":"2008-11-04T23:15:44Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 4 Nov 2008, Bernt Hansen wrote:\n\n> Commits B, C, and D are not included in the git log -S output even\n> though with gitk you can see that 'org-publish-validate-link' is in the\n> patch.\n\nIt is not sufficient for it to be in the patch, it has to be added or \ndeleted in whole.  So for example if you had a line\n\n\torg-publish-validate-link Hello\n\nand you changed it to\n\n\torg-publish-validate-link World\n\ngit log -SWorld will find the commit, but git log \n-Sorg-publish-validate-link will not.\n\nHth,\nDscho\n"},{"id":"94934","messageId":"7vod0voy22.fsf@gitster.siamese.dyndns.org","threadId":"16174","inReplyTo":"alpine.DEB.1.00.0811050014310.30769@pacific.mpi-cbg.de","subject":"Re: git log -S doesn't find some commits","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-11-04T23:45:25Z","receivedAt":"2008-11-04T23:45:25Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> On Tue, 4 Nov 2008, Bernt Hansen wrote:\n>\n>> Commits B, C, and D are not included in the git log -S output even\n>> though with gitk you can see that 'org-publish-validate-link' is in the\n>> patch.\n>\n> It is not sufficient for it to be in the patch, it has to be added or \n> deleted in whole.  So for example if you had a line\n>\n> \torg-publish-validate-link Hello\n>\n> and you changed it to\n>\n> \torg-publish-validate-link World\n>\n> git log -SWorld will find the commit, but git log \n> -Sorg-publish-validate-link will not.\n\nIt seems nobody has looked at the actual commits, but Dscho got it 80%\nright.\n\nThere seems to be a misconception on what -S<foo> does.  It does *NOT*\ngrep for string <foo> in the patch text.  It counts number of <foo> in\npreimage and postimage and decides that the commit is worth showing iff\nthey differ.\n\nIf you look at, for example (B):\n\n    http://repo.or.cz/w/org-mode.git?a=commitdiff;h=837c81ce51\n\nYou can see that in org-publish.el, org-publish-validate-link appears once\nas removed and once as added, so the total number of the appearance of the\nsymbol in preimage and postimage are the same.\n"},{"id":"94943","messageId":"87bpwvrpbk.fsf@gollum.intra.norang.ca","threadId":"16174","inReplyTo":"alpine.DEB.1.00.0811050014310.30769@pacific.mpi-cbg.de","subject":"Re: git log -S doesn't find some commits","fromName":"Bernt Hansen","fromEmail":"bernt@norang.ca","sentAt":"2008-11-05T00:25:51Z","receivedAt":"2008-11-05T00:25:51Z","isPatch":false,"sender":{"key":"bernt@norang.ca","avatar":null},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> On Tue, 4 Nov 2008, Bernt Hansen wrote:\n>\n>> Commits B, C, and D are not included in the git log -S output even\n>> though with gitk you can see that 'org-publish-validate-link' is in the\n>> patch.\n>\n> It is not sufficient for it to be in the patch, it has to be added or \n> deleted in whole.  So for example if you had a line\n>\n> \torg-publish-validate-link Hello\n>\n> and you changed it to\n>\n> \torg-publish-validate-link World\n>\n> git log -SWorld will find the commit, but git log \n> -Sorg-publish-validate-link will not.\n\nAh I wasn't aware of that.\n\nIn this case the function 'org-publish-validate-link' was commented out,\nand then in a later commit the comments were removed.\n\nI was expecting these commits to be found by git log -S.\n\nThanks!\n\nBernt\n"},{"id":"94944","messageId":"877i7jrp67.fsf@gollum.intra.norang.ca","threadId":"16174","inReplyTo":"7vod0voy22.fsf@gitster.siamese.dyndns.org","subject":"Re: git log -S doesn't find some commits","fromName":"Bernt Hansen","fromEmail":"bernt@norang.ca","sentAt":"2008-11-05T00:29:04Z","receivedAt":"2008-11-05T00:29:04Z","isPatch":false,"sender":{"key":"bernt@norang.ca","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n>\n>> On Tue, 4 Nov 2008, Bernt Hansen wrote:\n>>\n>>> Commits B, C, and D are not included in the git log -S output even\n>>> though with gitk you can see that 'org-publish-validate-link' is in the\n>>> patch.\n>>\n>> It is not sufficient for it to be in the patch, it has to be added or \n>> deleted in whole.  So for example if you had a line\n>>\n>> \torg-publish-validate-link Hello\n>>\n>> and you changed it to\n>>\n>> \torg-publish-validate-link World\n>>\n>> git log -SWorld will find the commit, but git log \n>> -Sorg-publish-validate-link will not.\n>\n> It seems nobody has looked at the actual commits, but Dscho got it 80%\n> right.\n>\n> There seems to be a misconception on what -S<foo> does.  It does *NOT*\n> grep for string <foo> in the patch text.  It counts number of <foo> in\n> preimage and postimage and decides that the commit is worth showing iff\n> they differ.\n>\n> If you look at, for example (B):\n>\n>     http://repo.or.cz/w/org-mode.git?a=commitdiff;h=837c81ce51\n>\n> You can see that in org-publish.el, org-publish-validate-link appears once\n> as removed and once as added, so the total number of the appearance of the\n> symbol in preimage and postimage are the same.\n\nNow I get it :)\n\nThanks both of you!\n\nRegards,\nBernt\n"},{"id":"94948","messageId":"7vy6zzm02b.fsf@gitster.siamese.dyndns.org","threadId":"16174","inReplyTo":"877i7jrp67.fsf@gollum.intra.norang.ca","subject":"Re: git log -S doesn't find some commits","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-11-05T01:30:20Z","receivedAt":"2008-11-05T01:30:20Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bernt Hansen <bernt@norang.ca> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n> ...\n>> There seems to be a misconception on what -S<foo> does.  It does *NOT*\n>> grep for string <foo> in the patch text.  It counts number of <foo> in\n>> preimage and postimage and decides that the commit is worth showing iff\n>> they differ.\n>>\n>> If you look at, for example (B):\n>>\n>>     http://repo.or.cz/w/org-mode.git?a=commitdiff;h=837c81ce51\n>>\n>> You can see that in org-publish.el, org-publish-validate-link appears once\n>> as removed and once as added, so the total number of the appearance of the\n>> symbol in preimage and postimage are the same.\n>\n> Now I get it :)\n>\n> Thanks both of you!\n\nBy the way, I would not be opposed to a new feature, perhaps triggered\nwith -G<foo>, that acts as if it is grepping inside the patch text.\n\nThe reason behind -S<foo>'s behaviour is because it was designed as a part\nofa \"incremetal digging\" tool before the current \"git-blame\" that allows\nto track even line-movements.\n\nThat is, you could write a tool to help the following interactively:\n\n (1) get interested in a block of text in a recent version;\n\n (2) feed that to 'git log' like this:\n\n \tgit log -1 -p -S\"$potentially_multi_line_text\" $rev\n\n     this will find an old rev R whose parent R^ did not have the lines\n     in the exact form you fed with -S.\n\n (3) inspect the output, and decide what to do next:\n\n     (3-a) you may want to adjust the text you look for, taking into\n     account how the neighbouring lines used to look like in R^, and run\n     another \"git log -S\" starting at R^; and/or\n\n     (3-b) you may want to run \"git grep\" for the text in the entire\n     tree in R^, to see if this was a code refactoring that consolidates\n     multiple copies of the same thing into a single place.\n\n     and go back to step (2).\n\n\ncf. http://thread.gmane.org/gmane.comp.version-control.git/27/focus=217\n"}]}