{"thread":{"id":"14039","subject":"Including branch info in git format-patch","startedAt":"2008-06-19T15:42:52Z","lastAt":"2008-06-19T21:55:13Z","messageCount":9,"participants":["Mukund Sivaraman","Jeff King","Junio C Hamano","Sverre Rabbelier"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"80326","messageId":"20080619154251.GA16475@jurassic","threadId":"14039","inReplyTo":null,"subject":"Including branch info in git format-patch","fromName":"Mukund Sivaraman","fromEmail":"muks@banu.com","sentAt":"2008-06-19T15:42:52Z","receivedAt":"2008-06-19T15:42:52Z","isPatch":false,"sender":{"key":"muks@banu.com","avatar":null},"body":"Hi all\n\nWe have two public branches on the tinyproxy project[1]: master and 1.6.\nWe send patches to the mailing list to get them reviewed before they are\napplied and pushed to the public repo.\n\nWhen i use \"git format-patch\", it doesn't seem to include the branch (or\nremote) name in the email it creates. So a reader of this mail may not\nknow what branch to apply it on to test it. Aside from adding in branch\ninformation manually in the body of the message, is there any other\nexisting way to get git format-patch to include it?\n\nApologies in advance if this is a stupid question.\n\n\t\tMukund\n\nRefs:\n 1. http://git.banu.com/?p=tinyproxy;a=summary\n"},{"id":"80363","messageId":"20080619202843.GA6207@sigill.intra.peff.net","threadId":"14039","inReplyTo":"20080619154251.GA16475@jurassic","subject":"Re: Including branch info in git format-patch","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-19T20:28:43Z","receivedAt":"2008-06-19T20:28:43Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 19, 2008 at 09:12:52PM +0530, Mukund Sivaraman wrote:\n\n> When i use \"git format-patch\", it doesn't seem to include the branch (or\n> remote) name in the email it creates. So a reader of this mail may not\n> know what branch to apply it on to test it. Aside from adding in branch\n> information manually in the body of the message, is there any other\n> existing way to get git format-patch to include it?\n\nNo, there isn't a way to do it automatically. On this mailing list,\npatches are assumed to be on top of \"master\" unless explicitly indicated\notherwise. And we usually just mention it manually.\n\nYou could potentially add a config option to put the branch name inside\nthe '[PATCH]' text. This text is generally stripped away before\napplying, so it would still free up the receiver to apply on whatever\nbranch they wanted. I don't think it would make sense for git\ndevelopment, since we typically use topic branches, so keeping it\nconfigurable would make sense.\n\nOn the receiving end, the applying party could set up their MUA to split\npatches based on the subject, and then apply them as appropriate (this\nvery much depends on their workflow for applying patches). You could\nprobably even do a pre-applypatch hook as a safety valve to make sure\nthings were being applied in the right place.\n\n-Peff\n"},{"id":"80367","messageId":"7vskv9rvrc.fsf@gitster.siamese.dyndns.org","threadId":"14039","inReplyTo":"20080619202843.GA6207@sigill.intra.peff.net","subject":"Re: Including branch info in git format-patch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-19T20:54:15Z","receivedAt":"2008-06-19T20:54:15Z","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> You could potentially add a config option to put the branch name inside\n> the '[PATCH]' text. This text is generally stripped away before\n> applying, so it would still free up the receiver to apply on whatever\n> branch they wanted. I don't think it would make sense for git\n> development, since we typically use topic branches, so keeping it\n> configurable would make sense.\n\nPeople would work on individual patches on topic branches that are named\ndifferently from the branch on the other end anyway (the branch that\ncorresonds to the other end will be used for local integration testing in\nsuch a setup), so I do not see much point in stating which local branch\nhappened to have been checked out when the patch was generated, in the\noutput.\n\nAlso, in git, there is no independent \"branch history\", so anybody who\nsays \"this patch was taken from this branch\" is either speaking very\nloosely, or does not understand git's branching model at all, or bit of\nboth.\n\nIf you have a history of this shape:\n\n                    (other cruft)\n                          \\\n                   ----o---o next\n                      /\n         o---o---o---o master\n        /       /\n    ---o---o---A\n\nwhich \"branch label\" would you give to the format-patch output that shows\ncommit A?  It may apply to both master and next, and it is really up to\nthe project's convention what to do with it.  The side branch the patch\nwas developed on may be named \"quick-hack\", which would not have any\nrelevance to the final location of where that patch wants to be in.\n"},{"id":"80369","messageId":"20080619210617.GC6529@sigill.intra.peff.net","threadId":"14039","inReplyTo":"7vskv9rvrc.fsf@gitster.siamese.dyndns.org","subject":"Re: Including branch info in git format-patch","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-19T21:06:17Z","receivedAt":"2008-06-19T21:06:17Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 19, 2008 at 01:54:15PM -0700, Junio C Hamano wrote:\n\n> > You could potentially add a config option to put the branch name inside\n> > the '[PATCH]' text. This text is generally stripped away before\n> > applying, so it would still free up the receiver to apply on whatever\n> > branch they wanted. I don't think it would make sense for git\n> > development, since we typically use topic branches, so keeping it\n> > configurable would make sense.\n> \n> People would work on individual patches on topic branches that are named\n> differently from the branch on the other end anyway (the branch that\n> corresonds to the other end will be used for local integration testing in\n> such a setup), so I do not see much point in stating which local branch\n> happened to have been checked out when the patch was generated, in the\n> output.\n\nI think that is totally dependent on the workflow, which is what I was\ntrying to say above. It really depends on how the patch-submitter\norganizes his branches.\n\n> the project's convention what to do with it.  The side branch the patch\n> was developed on may be named \"quick-hack\", which would not have any\n> relevance to the final location of where that patch wants to be in.\n\nI suspect you would do better to look at branch.quick-hack.merge, so\nthat you say \"this was based on upstream's X\", not \"this is my\nquick-hack\".\n\nBut there are so many ways this could go wrong, since the patches you're\nformatting might not even have anything to do with the branch you're on.\n\n-Peff\n"},{"id":"80370","messageId":"20080619210804.GA6700@sigill.intra.peff.net","threadId":"14039","inReplyTo":"20080619210617.GC6529@sigill.intra.peff.net","subject":"Re: Including branch info in git format-patch","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-06-19T21:08:05Z","receivedAt":"2008-06-19T21:08:05Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 19, 2008 at 05:06:17PM -0400, Jeff King wrote:\n\n> > the project's convention what to do with it.  The side branch the patch\n> > was developed on may be named \"quick-hack\", which would not have any\n> > relevance to the final location of where that patch wants to be in.\n> \n> I suspect you would do better to look at branch.quick-hack.merge, so\n> that you say \"this was based on upstream's X\", not \"this is my\n> quick-hack\".\n> \n> But there are so many ways this could go wrong, since the patches you're\n> formatting might not even have anything to do with the branch you're on.\n\nSide note: if you have a particular workflow, it might make sense,\nrather than using format-patch directly, to codify that workflow in\nanother script which says \"ok, this is how I grab a branch and send it\nupstream\". And in that case, you could look up \"here's where I branched\nfrom\" and feed it into the patch via format-patch's --subject-prefix\noption.\n\n-Peff\n"},{"id":"80372","messageId":"bd6139dc0806191415r64755ef3p90cecba7a074d9bc@mail.gmail.com","threadId":"14039","inReplyTo":"7vskv9rvrc.fsf@gitster.siamese.dyndns.org","subject":"Re: Including branch info in git format-patch","fromName":"Sverre Rabbelier","fromEmail":"alturin@gmail.com","sentAt":"2008-06-19T21:15:57Z","receivedAt":"2008-06-19T21:15:57Z","isPatch":false,"sender":{"key":"alturin@gmail.com","avatar":null},"body":"On Thu, Jun 19, 2008 at 10:54 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Jeff King <peff@peff.net> writes:\n>\n>> You could potentially add a config option to put the branch name inside\n>> the '[PATCH]' text. This text is generally stripped away before\n>> applying, so it would still free up the receiver to apply on whatever\n>> branch they wanted. I don't think it would make sense for git\n>> development, since we typically use topic branches, so keeping it\n>> configurable would make sense.\n>\n> People would work on individual patches on topic branches that are named\n> differently from the branch on the other end anyway (the branch that\n> corresonds to the other end will be used for local integration testing in\n> such a setup), so I do not see much point in stating which local branch\n> happened to have been checked out when the patch was generated, in the\n> output.\n\nI think what Mukund is asking for is a way to specify what upstream\nbranch the commit should be applied to. This would be a feature to\nhelp the person who is going to do the applying, so it is ok if the\nperson formatting the patch has to do a little work for that (e.g.,\nspecify which upstream branch to format-patch as a cmdline option)\n\n> If you have a history of this shape:\n<snip>\n> which \"branch label\" would you give to the format-patch output that shows\n> commit A?  It may apply to both master and next, and it is really up to\n> the project's convention what to do with it.  The side branch the patch\n> was developed on may be named \"quick-hack\", which would not have any\n> relevance to the final location of where that patch wants to be in.\n\nYou would give it the label of the branch you want it applied to!\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"80375","messageId":"20080619212626.GA29643@jurassic","threadId":"14039","inReplyTo":"7vskv9rvrc.fsf@gitster.siamese.dyndns.org","subject":"Re: Including branch info in git format-patch","fromName":"Mukund Sivaraman","fromEmail":"muks@banu.com","sentAt":"2008-06-19T21:26:27Z","receivedAt":"2008-06-19T21:26:27Z","isPatch":false,"sender":{"key":"muks@banu.com","avatar":null},"body":"On Thu, Jun 19, 2008 at 01:54:15PM -0700, Junio C Hamano wrote:\n> If you have a history of this shape:\n> \n>                     (other cruft)\n>                           \\\n>                    ----o---o next\n>                       /\n>          o---o---o---o master\n>         /       /\n>     ---o---o---A\n> \n> which \"branch label\" would you give to the format-patch output that shows\n> commit A?  It may apply to both master and next, and it is really up to\n> the project's convention what to do with it.  The side branch the patch\n> was developed on may be named \"quick-hack\", which would not have any\n> relevance to the final location of where that patch wants to be in.\n\nI follow what you are saying. In our workflow case, pointing out the\nremote (public) branch name should be sufficient (as this's the public\nshared branch among us, and all patchsets shared with others are against\nthe public branches). Perhaps I can add it to the [PATCH] text in the\nsubject line as Jeff suggests.\n\nMy problem is that I can't send a patch out to the list for other\ndevelopers to try, without some annotation for them, of which branch to\ntry it on.\n\n\t\tMukund\n"},{"id":"80378","messageId":"7vod5xrtjx.fsf@gitster.siamese.dyndns.org","threadId":"14039","inReplyTo":"20080619212626.GA29643@jurassic","subject":"Re: Including branch info in git format-patch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-19T21:41:54Z","receivedAt":"2008-06-19T21:41:54Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Mukund Sivaraman <muks@banu.com> writes:\n\n> My problem is that I can't send a patch out to the list for other\n> developers to try, without some annotation for them, of which branch to\n> try it on.\n\nSo what's wrong telling that when you send out the patch, between the time\nyou run format-patch and send-email?\n"},{"id":"80384","messageId":"20080619215512.GA29693@jurassic","threadId":"14039","inReplyTo":"7vod5xrtjx.fsf@gitster.siamese.dyndns.org","subject":"Re: Including branch info in git format-patch","fromName":"Mukund Sivaraman","fromEmail":"muks@banu.com","sentAt":"2008-06-19T21:55:13Z","receivedAt":"2008-06-19T21:55:13Z","isPatch":false,"sender":{"key":"muks@banu.com","avatar":null},"body":"On Thu, Jun 19, 2008 at 02:41:54PM -0700, Junio C Hamano wrote:\n> > My problem is that I can't send a patch out to the list for other\n> > developers to try, without some annotation for them, of which branch to\n> > try it on.\n> \n> So what's wrong telling that when you send out the patch, between the time\n> you run format-patch and send-email?\n> \n\nI had asked if there was some way the remote branch name could\nautomatically be inserted by git format-patch, instead of manually adding\nit in the patch message or in a cover letter. What Jeff suggested seems\ngood to me (of using --subject-prefix) as that is removed automatically\nwhen the patch is applied by git am.\n\n\t\tMukund\n"}]}