{"thread":{"id":"27324","subject":"Question about git-cherry and the rev list it's using","startedAt":"2011-05-11T16:11:23Z","lastAt":"2011-05-13T16:29:35Z","messageCount":6,"participants":["Francis Moreau","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"167666","messageId":"BANLkTinMfVE=s+TouyxE-ucf7MHGf1m7HA@mail.gmail.com","threadId":"27324","inReplyTo":null,"subject":"Question about git-cherry and the rev list it's using","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2011-05-11T16:11:23Z","receivedAt":"2011-05-11T16:11:23Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"Hello,\n\nI'm using \"git cherry old master base\" to see if all commits between\nmaster and base have been applied in my 'old' branch.\n\nSo I expect that git cherry is using a list of commits given by : \"git\nrev-list --no-merges base..master\".\n\nBut it looks like it's not the case:\n\n  $ git rev-list --no-merges --oneline base..master | wc -l\n  22\n\n  $ git cherry old master base | wc -l\n  12\n\nCould anybody help me on this because I don't understand the results I have ?\n\nThanks\n-- \nFrancis\n"},{"id":"167706","messageId":"4DCB826F.5020406@drmicha.warpmail.net","threadId":"27324","inReplyTo":"BANLkTinMfVE=s+TouyxE-ucf7MHGf1m7HA@mail.gmail.com","subject":"Re: Question about git-cherry and the rev list it's using","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-05-12T06:47:11Z","receivedAt":"2011-05-12T06:47:11Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Francis Moreau venit, vidit, dixit 11.05.2011 18:11:\n> Hello,\n> \n> I'm using \"git cherry old master base\" to see if all commits between\n> master and base have been applied in my 'old' branch.\n> \n> So I expect that git cherry is using a list of commits given by : \"git\n> rev-list --no-merges base..master\".\n\nNot really.\n\nFor each commit in \"--no-merges old..master ^base\" (i.e. \"--no-merges\nmaster ^old ^base\"), \"git cherry\" checks whether there is a patch\nequivalent commit in \"--no-merges master..old\", and outputs it with + or -.\n\n> But it looks like it's not the case:\n> \n>   $ git rev-list --no-merges --oneline base..master | wc -l\n>   22\n> \n>   $ git cherry old master base | wc -l\n>   12\n> \n> Could anybody help me on this because I don't understand the results I have ?\n\n\"--no-merges ^old ^base\" should rev-list --count to 12.\n\nBut you may be better off with something like\n\ngit rev-list --count --cherry master...old ^base\n\n(untested)\n\nMichael\n"},{"id":"167769","messageId":"BANLkTi=qRbpBG_PDPjO_TVEe+nWqrFQ28w@mail.gmail.com","threadId":"27324","inReplyTo":"4DCB826F.5020406@drmicha.warpmail.net","subject":"Re: Question about git-cherry and the rev list it's using","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2011-05-13T06:54:37Z","receivedAt":"2011-05-13T06:54:37Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"[ resending to the mailing list too ]\n\nOn Thu, May 12, 2011 at 8:47 AM, Michael J Gruber\n<git@drmicha.warpmail.net> wrote:\n> Francis Moreau venit, vidit, dixit 11.05.2011 18:11:\n>> Hello,\n>>\n>> I'm using \"git cherry old master base\" to see if all commits between\n>> master and base have been applied in my 'old' branch.\n>>\n>> So I expect that git cherry is using a list of commits given by : \"git\n>> rev-list --no-merges base..master\".\n>\n> Not really.\n>\n> For each commit in \"--no-merges old..master ^base\" (i.e. \"--no-merges\n> master ^old ^base\"), \"git cherry\" checks whether there is a patch\n> equivalent commit in \"--no-merges master..old\", and outputs it with + or -.\n>\n\noh you're right, I missed the case when old has been merged in master.\n\nThanks !\n-- \nFrancis\n"},{"id":"167770","messageId":"BANLkTi=d+gDhgnmOzUDfHhGJP76JuLHJ2Q@mail.gmail.com","threadId":"27324","inReplyTo":"BANLkTi=qRbpBG_PDPjO_TVEe+nWqrFQ28w@mail.gmail.com","subject":"Re: Question about git-cherry and the rev list it's using","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2011-05-13T07:02:27Z","receivedAt":"2011-05-13T07:02:27Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"On Fri, May 13, 2011 at 8:54 AM, Francis Moreau <francis.moro@gmail.com> wrote:\n> [ resending to the mailing list too ]\n>\n> On Thu, May 12, 2011 at 8:47 AM, Michael J Gruber\n> <git@drmicha.warpmail.net> wrote:\n>> Francis Moreau venit, vidit, dixit 11.05.2011 18:11:\n>>> Hello,\n>>>\n>>> I'm using \"git cherry old master base\" to see if all commits between\n>>> master and base have been applied in my 'old' branch.\n>>>\n>>> So I expect that git cherry is using a list of commits given by : \"git\n>>> rev-list --no-merges base..master\".\n>>\n>> Not really.\n>>\n>> For each commit in \"--no-merges old..master ^base\" (i.e. \"--no-merges\n>> master ^old ^base\"), \"git cherry\" checks whether there is a patch\n>> equivalent commit in \"--no-merges master..old\", and outputs it with + or -.\n>>\n>\n> oh you're right, I missed the case when old has been merged in master.\n>\n\nBTW, can't it be convenient for users if git-cherry also displays the\nsha1 of the commits which have been merged upstream (the ones with the\n'-' sign) ?\n\nThanks\n-- \nFrancis\n"},{"id":"167791","messageId":"4DCD1254.4050008@drmicha.warpmail.net","threadId":"27324","inReplyTo":"BANLkTi=d+gDhgnmOzUDfHhGJP76JuLHJ2Q@mail.gmail.com","subject":"Re: Question about git-cherry and the rev list it's using","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-05-13T11:13:24Z","receivedAt":"2011-05-13T11:13:24Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Francis Moreau venit, vidit, dixit 13.05.2011 09:02:\n> On Fri, May 13, 2011 at 8:54 AM, Francis Moreau <francis.moro@gmail.com> wrote:\n>> [ resending to the mailing list too ]\n>>\n>> On Thu, May 12, 2011 at 8:47 AM, Michael J Gruber\n>> <git@drmicha.warpmail.net> wrote:\n>>> Francis Moreau venit, vidit, dixit 11.05.2011 18:11:\n>>>> Hello,\n>>>>\n>>>> I'm using \"git cherry old master base\" to see if all commits between\n>>>> master and base have been applied in my 'old' branch.\n>>>>\n>>>> So I expect that git cherry is using a list of commits given by : \"git\n>>>> rev-list --no-merges base..master\".\n>>>\n>>> Not really.\n>>>\n>>> For each commit in \"--no-merges old..master ^base\" (i.e. \"--no-merges\n>>> master ^old ^base\"), \"git cherry\" checks whether there is a patch\n>>> equivalent commit in \"--no-merges master..old\", and outputs it with + or -.\n>>>\n>>\n>> oh you're right, I missed the case when old has been merged in master.\n>>\n> \n> BTW, can't it be convenient for users if git-cherry also displays the\n> sha1 of the commits which have been merged upstream (the ones with the\n> '-' sign) ?\n\n(I assume you mean the sha1 of the commit as it is in upstream.)\n\nWell, in general the map \"sha1 to patchid\" is not one-to-one and may not\neven be two-to-one. So we possibly would have to list more than one sha1\nalong with the -1. Anyways, with the current implementation you can't do\nthat, and it is not simple to change (because we may traverse *a lot* of\ncommits if base and upstream are far apart or disconnected).\n\nNote that \"git cherry -v\" gives you the subjects so that you can grep\nfor those in case they match in your work flow. Same with \"git log\n--cherry --oneline\" etc..\n\nMichael\n"},{"id":"167809","messageId":"BANLkTik4Gt8y0kSBcMrROTd67dfxMXO-KA@mail.gmail.com","threadId":"27324","inReplyTo":"4DCD1254.4050008@drmicha.warpmail.net","subject":"Re: Question about git-cherry and the rev list it's using","fromName":"Francis Moreau","fromEmail":"francis.moro@gmail.com","sentAt":"2011-05-13T16:29:35Z","receivedAt":"2011-05-13T16:29:35Z","isPatch":false,"sender":{"key":"francis.moro@gmail.com","avatar":null},"body":"On Fri, May 13, 2011 at 1:13 PM, Michael J Gruber\n<git@drmicha.warpmail.net> wrote:\n> Francis Moreau venit, vidit, dixit 13.05.2011 09:02:\n>> On Fri, May 13, 2011 at 8:54 AM, Francis Moreau <francis.moro@gmail.com> wrote:\n>>> [ resending to the mailing list too ]\n>>>\n>>> On Thu, May 12, 2011 at 8:47 AM, Michael J Gruber\n>>> <git@drmicha.warpmail.net> wrote:\n>>>> Francis Moreau venit, vidit, dixit 11.05.2011 18:11:\n>>>>> Hello,\n>>>>>\n>>>>> I'm using \"git cherry old master base\" to see if all commits between\n>>>>> master and base have been applied in my 'old' branch.\n>>>>>\n>>>>> So I expect that git cherry is using a list of commits given by : \"git\n>>>>> rev-list --no-merges base..master\".\n>>>>\n>>>> Not really.\n>>>>\n>>>> For each commit in \"--no-merges old..master ^base\" (i.e. \"--no-merges\n>>>> master ^old ^base\"), \"git cherry\" checks whether there is a patch\n>>>> equivalent commit in \"--no-merges master..old\", and outputs it with + or -.\n>>>>\n>>>\n>>> oh you're right, I missed the case when old has been merged in master.\n>>>\n>>\n>> BTW, can't it be convenient for users if git-cherry also displays the\n>> sha1 of the commits which have been merged upstream (the ones with the\n>> '-' sign) ?\n>\n> (I assume you mean the sha1 of the commit as it is in upstream.)\n\nyes.\n\n>\n> Well, in general the map \"sha1 to patchid\" is not one-to-one and may not\n> even be two-to-one. So we possibly would have to list more than one sha1\n> along with the -1.\n\njust showing the latest one would be nice though.\n\n> Anyways, with the current implementation you can't do\n> that, and it is not simple to change (because we may traverse *a lot* of\n> commits if base and upstream are far apart or disconnected).\n\nAh, with my naive view I would have thought that to process the\npatch-id of a commit in upstream and compare it, git has the sha1.\n\n>\n> Note that \"git cherry -v\" gives you the subjects so that you can grep\n> for those in case they match in your work flow. Same with \"git log\n> --cherry --oneline\" etc..\n\nyes but as you said the subjects must match which is not always the\ncase (otherwise that would make patch-id unneeded)\n\nThanks\n-- \nFrancis\n"}]}