{"thread":{"id":"8295","subject":"How do we import patches from non-git sources?","startedAt":"2007-05-24T14:30:10Z","lastAt":"2007-06-14T07:53:36Z","messageCount":14,"participants":["Marc Singer","Johannes Schindelin","Yann Dirson","Linus Torvalds","Jakub Narebski","J. Bruce Fields","Matthieu Moy","Jon Loeliger"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"43143","messageId":"1180017010.21181.2.camel@zealous.synapsedev.com","threadId":"8295","inReplyTo":null,"subject":"How do we import patches from non-git sources?","fromName":"Marc Singer","fromEmail":"elf@synapse.com","sentAt":"2007-05-24T14:30:10Z","receivedAt":"2007-05-24T14:30:10Z","isPatch":false,"sender":{"key":"elf@synapse.com","avatar":null},"body":"It looks like it reduces to something very simple.\n\nGit patches, as generated by git-format-patch, have a header with an\nemail address.\n\nCogito patches, as generated by cg-mkpatch, have no email address in the\nheader.\n\ngit-am doesn't like the cogito patches.\n\nIs there a way to import patches that did not come from git?  Remember\nthat we'd like to include the functionality of git-am that adds new\nfiles to the index.\n\nCheers.\n"},{"id":"43145","messageId":"Pine.LNX.4.64.0705241628430.4648@racer.site","threadId":"8295","inReplyTo":"1180017010.21181.2.camel@zealous.synapsedev.com","subject":"Re: How do we import patches from non-git sources?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-05-24T15:29:22Z","receivedAt":"2007-05-24T15:29:22Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 24 May 2007, Marc Singer wrote:\n\n> It looks like it reduces to something very simple.\n> \n> Git patches, as generated by git-format-patch, have a header with an\n> email address.\n> \n> Cogito patches, as generated by cg-mkpatch, have no email address in the\n> header.\n> \n> git-am doesn't like the cogito patches.\n\nWhat author should git-am assume?\n\n> Is there a way to import patches that did not come from git?  Remember\n> that we'd like to include the functionality of git-am that adds new\n> files to the index.\n\nYou can always use git-apply to apply patches. You have to commit them \nyourself, though.\n\nCiao,\nDscho\n"},{"id":"43183","messageId":"20070524212202.GW19253@nan92-1-81-57-214-146.fbx.proxad.net","threadId":"8295","inReplyTo":"1180017010.21181.2.camel@zealous.synapsedev.com","subject":"Re: How do we import patches from non-git sources?","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-05-24T21:22:02Z","receivedAt":"2007-05-24T21:22:02Z","isPatch":false,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"On Thu, May 24, 2007 at 07:30:10AM -0700, Marc Singer wrote:\n> Is there a way to import patches that did not come from git?  Remember\n> that we'd like to include the functionality of git-am that adds new\n> files to the index.\n\nI have written a patch-application tool as part of the (otherwise\nstalled) ArcheoloGIT project, clonable from\nhttp://ydirson.free.fr/soft/git/argit.git/.\n\nSide note: it could make sense to finalize this script and integrate\nit in git proper.  Opinions ?\n\n\nAlthough the command-line interface would probably benefit from an\noverhaul, it is fully functionning, notably supporting:\n\n- application of several patches in one row\n- application of non-incremental patches - eg. the 2.4.19rmk2 patch\napplies to plain 2.4.19, not to 2.4.19rmk1\n\n| $ ../argit/ag-import-patch --help\n| Usage: ag-import-patch ( [-v] [-n] [-b BASE|-i] [-N NAME] [-p PARENT]... [-t TAG] PATCH )*\n| \n| Import a revision in a GIT history from a patch.\n| Part of the ArcheoloGIT toolkit.\n| Copyright (c) Yann Dirson, 2005\n| Distributed under version 2 of the GNU GPL.\n\nSince it lacks doc, here is it:\n\n-i\t\t- process subsequent paches as incremental (the default)\n-b BASE\t\t- process subsequent paches as applying to commit BASE\n-N NAME \t- use given NAME instead of patch filename for generating\n\t\t  commit message (useful for /dev/stdin import)\n-t TAG\t\t- tag after import\n-p PARENT\t- add PARENT to the parents\n\neg:\n\n$ git checkout v2.4.19\n$ ag-import-patch -b v2.4.19 \\\n\t-p v2.4.18rmk6 -t v2.4.19rmk1 patch-2.4.19rmk1.diff \\\n\t-t v2.4.19rmk2 patch-2.4.19rmk2.diff \n\nHope this helps,\n-- \nYann.\n"},{"id":"43185","messageId":"alpine.LFD.0.98.0705241439220.26602@woody.linux-foundation.org","threadId":"8295","inReplyTo":"1180017010.21181.2.camel@zealous.synapsedev.com","subject":"Re: How do we import patches from non-git sources?","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-05-24T21:45:47Z","receivedAt":"2007-05-24T21:45:47Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 24 May 2007, Marc Singer wrote:\n> \n> Is there a way to import patches that did not come from git?  Remember\n> that we'd like to include the functionality of git-am that adds new\n> files to the index.\n\nThe normal thing to do is\n\n\tgit apply --index <patchfile>\n\nwhich will apply a patch _and_ update the index, so that you can then just \ndo a simple\n\n\tgit commit -m \"my message goes here\" --author \"the author goes here\"\n\nto create the commit, new (or deleted) files and all.\n\nOf course, the reason the \"normal\" patch format is an email, and not \njust a bare patch, is that an email contains so much more: it contains not \njust the patch, but the authorship information and the commit message.\n\nSo basically:\n - no, you _cannot_ just \"commit\" a patch, since a patch on its own \n   doesn't contain the required information to be a real commit.\n\n - but yes, you can obviously _apply_ a patch, and then commit it once you \n   add the proper information, but that does require more information than \n   just the patch itself includes.\n\nSo hopefully that clarified things.\n\n\t\tLinus\n"},{"id":"43236","messageId":"f36go6$2oe$2@sea.gmane.org","threadId":"8295","inReplyTo":"20070524212202.GW19253@nan92-1-81-57-214-146.fbx.proxad.net","subject":"Re: How do we import patches from non-git sources?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-05-25T11:24:37Z","receivedAt":"2007-05-25T11:24:37Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"[Cc: Yann Dirson <ydirson@altern.org>, git@vger.kernel.org]\n\nYann Dirson wrote:\n\n> I have written a patch-application tool as part of the (otherwise\n> stalled) ArcheoloGIT project, clonable from\n> http://ydirson.free.fr/soft/git/argit.git/.\n\nBy the way, have you considered adding a mirror of this repository\nto http://repo.or.cz ? This way you would have gitweb interface, and\nother protocols support.\n\nCould you edit description file, and add README if it does not exists?\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"44172","messageId":"1181151454.6086.23.camel@zealous.synapsedev.com","threadId":"8295","inReplyTo":"1180017010.21181.2.camel@zealous.synapsedev.com","subject":"Let me ask again: How do we import patches from non-git sources?","fromName":"Marc Singer","fromEmail":"elf@synapse.com","sentAt":"2007-06-06T17:37:34Z","receivedAt":"2007-06-06T17:37:34Z","isPatch":false,"sender":{"key":"elf@synapse.com","avatar":null},"body":"On Thu, 2007-05-24 at 07:30 -0700, Marc Singer wrote:\n> It looks like it reduces to something very simple.\n> \n> Git patches, as generated by git-format-patch, have a header with an\n> email address.\n> \n> Cogito patches, as generated by cg-mkpatch, have no email address in the\n> header.\n> \n> git-am doesn't like the cogito patches.\n> \n> Is there a way to import patches that did not come from git?  Remember\n> that we'd like to include the functionality of git-am that adds new\n> files to the index.\n> \n> Cheers.\n\nI have patches from another source as well and I'd like to be able to\nimport them even though these aren't from git.\n"},{"id":"44174","messageId":"20070606175458.GH12774@fieldses.org","threadId":"8295","inReplyTo":"1181151454.6086.23.camel@zealous.synapsedev.com","subject":"Re: Let me ask again: How do we import patches from non-git sources?","fromName":"J. Bruce Fields","fromEmail":"bfields@fieldses.org","sentAt":"2007-06-06T17:54:58Z","receivedAt":"2007-06-06T17:54:58Z","isPatch":false,"sender":{"key":"bfields@citi.umich.edu","avatar":null},"body":"On Wed, Jun 06, 2007 at 10:37:34AM -0700, Marc Singer wrote:\n> On Thu, 2007-05-24 at 07:30 -0700, Marc Singer wrote:\n> > It looks like it reduces to something very simple.\n> > \n> > Git patches, as generated by git-format-patch, have a header with an\n> > email address.\n> > \n> > Cogito patches, as generated by cg-mkpatch, have no email address in the\n> > header.\n> > \n> > git-am doesn't like the cogito patches.\n> > \n> > Is there a way to import patches that did not come from git?  Remember\n> > that we'd like to include the functionality of git-am that adds new\n> > files to the index.\n> > \n> > Cheers.\n> \n> I have patches from another source as well and I'd like to be able to\n> import them even though these aren't from git.\n\nBased on my notes from the last time I needed to feed a bunch of\nnon-mbox, non-git-produced patches into git-am, the hard part was\nfiguring out how it split a file into separate messages; my notes say:\n\n\t\"Finds lines begining with \"From \" and ending with \"hh:mm:ss\n\tyyyy\".  See builtin-mailsplit code for more details.\"\n\nOther than that, I think it just needs and From: and Subject: lines to\nget author and first-line of the commit.  the git-am man page has some\ndocumentation of this.  It could probably use more.\n\n--b.\n"},{"id":"44175","messageId":"vpqhcplx8vb.fsf@bauges.imag.fr","threadId":"8295","inReplyTo":"1181151454.6086.23.camel@zealous.synapsedev.com","subject":"Re: Let me ask again: How do we import patches from non-git sources?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-06-06T17:58:48Z","receivedAt":"2007-06-06T17:58:48Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Marc Singer <elf@synapse.com> writes:\n\n> On Thu, 2007-05-24 at 07:30 -0700, Marc Singer wrote:\n>> It looks like it reduces to something very simple.\n>> \n>> Git patches, as generated by git-format-patch, have a header with an\n>> email address.\n>> \n>> Cogito patches, as generated by cg-mkpatch, have no email address in the\n>> header.\n\nCogito is more or less depreceted now. You should probably use git\nitself.\n\n>> git-am doesn't like the cogito patches.\n>> \n>> Is there a way to import patches that did not come from git?  Remember\n>> that we'd like to include the functionality of git-am that adds new\n>> files to the index.\n>> \n>> Cheers.\n>\n> I have patches from another source as well and I'd like to be able to\n> import them even though these aren't from git.\n\nYou cannot \"import\" them, because they do not contain the necessary\ninformation (commit message and email adress). But you can \"apply\"\nthem, and then commit manually. Use git-patch (even just \"patch\" could\ndo) to apply the patch, and commit as usual.\n\n-- \nMatthieu\n"},{"id":"44177","messageId":"1181153904.12740.35.camel@ld0161-tx32","threadId":"8295","inReplyTo":"vpqhcplx8vb.fsf@bauges.imag.fr","subject":"Re: Let me ask again: How do we import patches from non-git sources?","fromName":"Jon Loeliger","fromEmail":"jdl@freescale.com","sentAt":"2007-06-06T18:18:24Z","receivedAt":"2007-06-06T18:18:24Z","isPatch":false,"sender":{"key":"jdl@jdl.com","avatar":"https://gravatar.com/avatar/75ce9a10b151acd2c28ec4ab2136dba7b2ff1634530bd04b155981a749d08a64?d=mp&s=160"},"body":"On Wed, 2007-06-06 at 12:58, Matthieu Moy wrote:\n\n> Cogito is more or less depreceted now. You should probably use git\n> itself.\n\nHmm.  We should then likely try to encourage kernel.org and denx.de\nfolks to advertise cloning their published repos with git rather\nthan cogito now.\n\njdl\n"},{"id":"44844","messageId":"1181665653.4194.24.camel@zealous.synapsedev.com","threadId":"8295","inReplyTo":"20070606175458.GH12774@fieldses.org","subject":"Re: Let me ask again: How do we import patches from non-git sources?","fromName":"Marc Singer","fromEmail":"elf@synapse.com","sentAt":"2007-06-12T16:27:33Z","receivedAt":"2007-06-12T16:27:33Z","isPatch":false,"sender":{"key":"elf@synapse.com","avatar":null},"body":"On Wed, 2007-06-06 at 13:54 -0400, J. Bruce Fields wrote:\n> Based on my notes from the last time I needed to feed a bunch of\n> non-mbox, non-git-produced patches into git-am, the hard part was\n> figuring out how it split a file into separate messages; my notes say:\n> \n> \t\"Finds lines begining with \"From \" and ending with \"hh:mm:ss\n> \tyyyy\".  See builtin-mailsplit code for more details.\"\n> \n> Other than that, I think it just needs and From: and Subject: lines to\n> get author and first-line of the commit.  the git-am man page has some\n> documentation of this.  It could probably use more.\n> \n\nI'm not sure that I understand your response. \n\ngit-am complains that it cannot find an email address, but raw patches\nseldom have these.  So, either we could use another command, or it would\nbe handy if we could supply the email address to git-am (or some other\ndata it needs so that it can split the patch.)  I suppose the mistaken\nassumption is that the patch source in an email instead of already being\na nice clean patch.\n"},{"id":"44858","messageId":"20070612181313.GB26767@fieldses.org","threadId":"8295","inReplyTo":"1181665653.4194.24.camel@zealous.synapsedev.com","subject":"Re: Let me ask again: How do we import patches from non-git sources?","fromName":"J. Bruce Fields","fromEmail":"bfields@fieldses.org","sentAt":"2007-06-12T18:13:13Z","receivedAt":"2007-06-12T18:13:13Z","isPatch":false,"sender":{"key":"bfields@citi.umich.edu","avatar":null},"body":"On Tue, Jun 12, 2007 at 09:27:33AM -0700, Marc Singer wrote:\n> On Wed, 2007-06-06 at 13:54 -0400, J. Bruce Fields wrote:\n> > Based on my notes from the last time I needed to feed a bunch of\n> > non-mbox, non-git-produced patches into git-am, the hard part was\n> > figuring out how it split a file into separate messages; my notes say:\n> > \n> > \t\"Finds lines begining with \"From \" and ending with \"hh:mm:ss\n> > \tyyyy\".  See builtin-mailsplit code for more details.\"\n> > \n> > Other than that, I think it just needs and From: and Subject: lines to\n> > get author and first-line of the commit.  the git-am man page has some\n> > documentation of this.  It could probably use more.\n> > \n> \n> I'm not sure that I understand your response. \n> \n> git-am complains that it cannot find an email address, but raw patches\n> seldom have these.  So, either we could use another command, or it would\n> be handy if we could supply the email address to git-am (or some other\n> data it needs so that it can split the patch.)  I suppose the mistaken\n> assumption is that the patch source in an email instead of already being\n> a nice clean patch.\n\nI think it's intentional.  You need some standard format git-am can use\nto split out the patches and find the comments and the authorship\ninformation (for the Author: field on the commit), so why not just use\nsomething like mbox?\n\nAnd it could provide some fallback for the \"Author:\" information in the\ncase where it didn't find that, but we wouldn't want that to be the\ndefault if it meant risking silently losing authorship information.  I\nsuppose an \"--author\" option to git-am might be convenient sometimes.\n\nBut personally I always just add those headers by hand (or with a\nscript).  It's not that hard; I the minimum required is just three\nlines, I think:\n\n\tFrom git-owner@vger.kernel.org Tue jun 12 11:43:40 2007\n\tFrom: someone <someone@example.com>\n\tSubject: [PATCH] do something\n\t\n\tDo something complicated.\n\t\n\t---\n\t\n\tdiff a/foo b/foo\n\t...\n\nAnd often I need different authors on different patches anyway, so\ngit-am --author wouldn't help.\n\nOf course if you've just got one patch to import, you can git-apply and\nthen commit.\n\n--b.\n\n(PS: Standard practice around here is to leave people on the To: and/or\nCc: lines when you reply, and for me at least that'd be easier.)\n"},{"id":"45028","messageId":"1181785504.4102.7.camel@zealous.synapsedev.com","threadId":"8295","inReplyTo":"20070612181313.GB26767@fieldses.org","subject":"Re: Let me ask again: How do we import patches from non-git sources?","fromName":"Marc Singer","fromEmail":"elf@synapse.com","sentAt":"2007-06-14T01:45:04Z","receivedAt":"2007-06-14T01:45:04Z","isPatch":false,"sender":{"key":"elf@synapse.com","avatar":null},"body":"On Tue, 2007-06-12 at 14:13 -0400, J. Bruce Fields wrote:\n> On Tue, Jun 12, 2007 at 09:27:33AM -0700, Marc Singer wrote:\n> > git-am complains that it cannot find an email address, but raw patches\n> > seldom have these.  So, either we could use another command, or it would\n> > be handy if we could supply the email address to git-am (or some other\n> > data it needs so that it can split the patch.)  I suppose the mistaken\n> > assumption is that the patch source in an email instead of already being\n> > a nice clean patch.\n> \n> I think it's intentional.  You need some standard format git-am can use\n> to split out the patches and find the comments and the authorship\n> information (for the Author: field on the commit), so why not just use\n> something like mbox?\n> \n> And it could provide some fallback for the \"Author:\" information in the\n> case where it didn't find that, but we wouldn't want that to be the\n> default if it meant risking silently losing authorship information.  I\n> suppose an \"--author\" option to git-am might be convenient sometimes.\n> \n> But personally I always just add those headers by hand (or with a\n> script).  It's not that hard; I the minimum required is just three\n> lines, I think:\n> \n> \tFrom git-owner@vger.kernel.org Tue jun 12 11:43:40 2007\n> \tFrom: someone <someone@example.com>\n> \tSubject: [PATCH] do something\n> \t\n> \tDo something complicated.\n> \t\n> \t---\n> \t\n> \tdiff a/foo b/foo\n> \t...\n> \n> And often I need different authors on different patches anyway, so\n> git-am --author wouldn't help.\n> \n> Of course if you've just got one patch to import, you can git-apply and\n> then commit.\n\nThanks for the response.\n\nI found that a deeper look into git-apply gives me a way to import\nforeign patches.  I still have to do some index management by hand, but\nit is much better than the alternative.\n\nYour suggestion, while clearly effective, seems cumbersome.  I suppose\nit may be worthwhile including a command that converts a foreign patch\ninto something that git better understands.  That would leave out this\nsort of complexity from the git-am program.  In fact, I can imaging a\ntool that lets the user fill in any pieces that aren't already present.\n\nHonestly, it may just be that I'm still below the knee on the learning\ncurve for git.\n\nCheers.\n"},{"id":"45029","messageId":"1181785754.4102.13.camel@zealous.synapsedev.com","threadId":"8295","inReplyTo":"1181153904.12740.35.camel@ld0161-tx32","subject":"Re: Let me ask again: How do we import patches from non-git sources?","fromName":"Marc Singer","fromEmail":"elf@synapse.com","sentAt":"2007-06-14T01:49:14Z","receivedAt":"2007-06-14T01:49:14Z","isPatch":false,"sender":{"key":"elf@synapse.com","avatar":null},"body":"On Wed, 2007-06-06 at 13:18 -0500, Jon Loeliger wrote:\n> On Wed, 2007-06-06 at 12:58, Matthieu Moy wrote:\n> \n> > Cogito is more or less depreceted now. You should probably use git\n> > itself.\n> \n> Hmm.  We should then likely try to encourage kernel.org and denx.de\n> folks to advertise cloning their published repos with git rather\n> than cogito now.\n\nIt's also users who are *just* getting their feet wet in the git pool.\n"},{"id":"45048","messageId":"vpqsl8v6kfz.fsf@bauges.imag.fr","threadId":"8295","inReplyTo":"1181785754.4102.13.camel@zealous.synapsedev.com","subject":"Re: Let me ask again: How do we import patches from non-git sources?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-06-14T07:53:36Z","receivedAt":"2007-06-14T07:53:36Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Marc Singer <elf@synapse.com> writes:\n\n> On Wed, 2007-06-06 at 13:18 -0500, Jon Loeliger wrote:\n>> On Wed, 2007-06-06 at 12:58, Matthieu Moy wrote:\n>> \n>> > Cogito is more or less depreceted now. You should probably use git\n>> > itself.\n>> \n>> Hmm.  We should then likely try to encourage kernel.org and denx.de\n>> folks to advertise cloning their published repos with git rather\n>> than cogito now.\n>\n> It's also users who are *just* getting their feet wet in the git pool.\n\nYes, and cogito definitely _used_ to be a very good thing for them.\nBut today, starting with cogito instead of git is not really easier\nfor a beginner: OK, the program is a bit simpler to use, but some\ncommands are missing, so you'll sometimes have to type \"git\" and\nsometimes \"cogito\" (the cogito tutorial was actually using a few git\ncommands). Then, the user comes on the mailing list and asks\nsomething, he will be answered in terms of git commands 95% of the\ntimes, ...\n\nFor that reasons, the maintainer of cogito said some time ago that he\nwas probably going to stop working on cogito. Maybe I missed something\nin the meantime, but I don't think anyone volunteered to continue with\ncogito. So, encourraging people to use cogito is a bit like \"hey, try\nthis, but once you've finished learning it, you'll have to forget it\nand migrate\" ...\n\n-- \nMatthieu\n"}]}