{"thread":{"id":"26241","subject":"Creating CVS-style patch headers with git-diff","startedAt":"2011-01-08T11:23:06Z","lastAt":"2011-01-08T16:35:25Z","messageCount":9,"participants":["David Chanters","Tomas Carnecky","Andreas Schwab","Robin Rosenberg"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"159210","messageId":"AANLkTinmq=3kJmtSVutf7dHAQ0QL3fr9_E3hZ7gDe1JY@mail.gmail.com","threadId":"26241","inReplyTo":null,"subject":"Creating CVS-style patch headers with git-diff","fromName":"David Chanters","fromEmail":"david.chanters@googlemail.com","sentAt":"2011-01-08T11:23:06Z","receivedAt":"2011-01-08T11:23:06Z","isPatch":false,"sender":{"key":"david.chanters@googlemail.com","avatar":null},"body":"Hi all,\n\n[ Please Cc me on any replies as I am not subscribed to this list, thanks. ]\n\nI am wondering if I can get git diff to create \"CVS-style patches\"?\nWhat do I mean by that?  Well, whenever I do:\n\ngit diff\n\nI get patch headers in the form:\n\ndiff --git a/foo.c b/foo.c\nindex 57b9527..a2d947b 100644\n--- a/foo.c\n+++ b/foo.c\n\nThis is fine for git, but if I then want to import the same patch into\nCVS I have to either edit the patch, or mess around with the -p option\nto patch(1).\n\nI have seen that git-diff has options to change the a/ b/ headers --\ncan anyone shed some light on this as to what I can do?\n\nThe reason I am wanting to do this, is rather than importing\nchangesets from git -> CVS, I have a git clone outright of a CVS\nproject (which I update with git-cvsimport) and often want to import\ndiffs to CVS directly after I'm done, and then I publish my topic\nbranches in Git when I'm done.  The key thing though is to be able to\napply patches from git -- and I am hoping the easiest thing to do is\nto try and get git-diff to change the headers.\n\nAny help greatly received.\n\nKindly,\nDavid\n"},{"id":"159212","messageId":"4D284F57.2000808@dbservice.com","threadId":"26241","inReplyTo":"AANLkTinmq=3kJmtSVutf7dHAQ0QL3fr9_E3hZ7gDe1JY@mail.gmail.com","subject":"Re: Creating CVS-style patch headers with git-diff","fromName":"Tomas Carnecky","fromEmail":"tom@dbservice.com","sentAt":"2011-01-08T11:49:43Z","receivedAt":"2011-01-08T11:49:43Z","isPatch":false,"sender":{"key":"tom@dbservice.com","avatar":"https://gravatar.com/avatar/900a300bdd1a8bbe086008ad78210bbee2ad2803b7d50a5cba04c1e9404bd6d2?d=mp&s=160"},"body":"  On 1/8/11 12:23 PM, David Chanters wrote:\n> Hi all,\n>\n> [ Please Cc me on any replies as I am not subscribed to this list, thanks. ]\n>\n> I am wondering if I can get git diff to create \"CVS-style patches\"?\n> What do I mean by that?  Well, whenever I do:\n>\n> git diff\n>\n> I get patch headers in the form:\n>\n> diff --git a/foo.c b/foo.c\n> index 57b9527..a2d947b 100644\n> --- a/foo.c\n> +++ b/foo.c\n>\n> This is fine for git, but if I then want to import the same patch into\n> CVS I have to either edit the patch, or mess around with the -p option\n> to patch(1).\nWhat exactly do you need to change in the patch? Remove the index line? \nThe '--git' string? Remove or change the a/, b/ prefix?\n> I have seen that git-diff has options to change the a/ b/ headers --\n> can anyone shed some light on this as to what I can do?\n\nAre you maybe looking for the --no-prefix option?\n\ntom\n"},{"id":"159215","messageId":"AANLkTinx9qM=fjH53UodY0G870Ne3wpFiFEgEGNXxOY7@mail.gmail.com","threadId":"26241","inReplyTo":"4D284F57.2000808@dbservice.com","subject":"Re: Creating CVS-style patch headers with git-diff","fromName":"David Chanters","fromEmail":"david.chanters@googlemail.com","sentAt":"2011-01-08T13:43:31Z","receivedAt":"2011-01-08T13:43:31Z","isPatch":false,"sender":{"key":"david.chanters@googlemail.com","avatar":null},"body":"Hi Tomas,\n\nOn 8 January 2011 11:49, Tomas Carnecky <tom@dbservice.com> wrote:\n> What exactly do you need to change in the patch? Remove the index line? The\n> '--git' string? Remove or change the a/, b/ prefix?\n\nWell, any one of those goals, really.  I just want to generate a patch\nthat CVS won't barf on -- what that means if not needing to use the\n\"-p\" option to patch because git outputs a/ b/ prefix lines.  Your\n\"--no-prefix\" option does that much, which might be enough.\n\nI did read, I think on this list, that the GNU Patch program\ninterprets these \"diff --git\" lines?  What exactly are they for, do\nyou know?  I mean, even if I just did:\n\ngit diff --no-prefix\n\nWould the presense of the other meta-data, such as the \"diff --git\"\nline as well as the \"Index\" line cause any problems when applying this\npatch in CVS (I suppose now, my question doesn't have to apply to CVS\nat all, more likely it will apply to any file sets)?  I am not sure\nhow GNU Patch uses this meta information, and I assume \"git diff\" adds\nit for a good reason.\n\nI hope this all makes sense?\n\nDavid\n"},{"id":"159217","messageId":"m2vd1za0af.fsf@igel.home","threadId":"26241","inReplyTo":"AANLkTinx9qM=fjH53UodY0G870Ne3wpFiFEgEGNXxOY7@mail.gmail.com","subject":"Re: Creating CVS-style patch headers with git-diff","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2011-01-08T15:21:44Z","receivedAt":"2011-01-08T15:21:44Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"David Chanters <david.chanters@googlemail.com> writes:\n\n> Well, any one of those goals, really.  I just want to generate a patch\n> that CVS won't barf on\n\nWhat does \"CVS won't barf\" mean in this context?  CVS does not operate\non patches.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"159218","messageId":"4D288211.3040806@dbservice.com","threadId":"26241","inReplyTo":"AANLkTinx9qM=fjH53UodY0G870Ne3wpFiFEgEGNXxOY7@mail.gmail.com","subject":"Re: Creating CVS-style patch headers with git-diff","fromName":"Tomas Carnecky","fromEmail":"tom@dbservice.com","sentAt":"2011-01-08T15:26:09Z","receivedAt":"2011-01-08T15:26:09Z","isPatch":false,"sender":{"key":"tom@dbservice.com","avatar":"https://gravatar.com/avatar/900a300bdd1a8bbe086008ad78210bbee2ad2803b7d50a5cba04c1e9404bd6d2?d=mp&s=160"},"body":"  On 1/8/11 2:43 PM, David Chanters wrote:\n> Would the presense of the other meta-data, such as the \"diff --git\"\n> line as well as the \"Index\" line cause any problems when applying this\n> patch in CVS (I suppose now, my question doesn't have to apply to CVS\n\nI don't know, you tell me. I've never used CVS.\n\n> at all, more likely it will apply to any file sets)?  I am not sure\n> how GNU Patch uses this meta information, and I assume \"git diff\" adds\n> it for a good reason.\n\ngnu patch most likely doesn't use the index line and ignores all the git \nspecific additions to the diff format.\n\ntom\n"},{"id":"159219","messageId":"AANLkTi=_YdTsvFboQAj447SUtcxrVhM18QkvSVdpvdMJ@mail.gmail.com","threadId":"26241","inReplyTo":"m2vd1za0af.fsf@igel.home","subject":"Re: Creating CVS-style patch headers with git-diff","fromName":"David Chanters","fromEmail":"david.chanters@googlemail.com","sentAt":"2011-01-08T15:35:39Z","receivedAt":"2011-01-08T15:35:39Z","isPatch":false,"sender":{"key":"david.chanters@googlemail.com","avatar":null},"body":"On 8 January 2011 15:21, Andreas Schwab <schwab@linux-m68k.org> wrote:\n> David Chanters <david.chanters@googlemail.com> writes:\n>\n>> Well, any one of those goals, really.  I just want to generate a patch\n>> that CVS won't barf on\n>\n> What does \"CVS won't barf\" mean in this context?  CVS does not operate\n> on patches.\n\nSorry about that, that's poor wording on my part.  I don't mean \"CVS\nwon't barf\" -- I meant that GNU Patch can still apply the patch\nwithout the meta-data referencing git still.  I think though this\n\"--no-prefix\" option might just do it.\n\nDavid\n"},{"id":"159220","messageId":"4D288804.2050204@dbservice.com","threadId":"26241","inReplyTo":"AANLkTi=_YdTsvFboQAj447SUtcxrVhM18QkvSVdpvdMJ@mail.gmail.com","subject":"Re: Creating CVS-style patch headers with git-diff","fromName":"Tomas Carnecky","fromEmail":"tom@dbservice.com","sentAt":"2011-01-08T15:51:32Z","receivedAt":"2011-01-08T15:51:32Z","isPatch":false,"sender":{"key":"tom@dbservice.com","avatar":"https://gravatar.com/avatar/900a300bdd1a8bbe086008ad78210bbee2ad2803b7d50a5cba04c1e9404bd6d2?d=mp&s=160"},"body":"  On 1/8/11 4:35 PM, David Chanters wrote:\n> Sorry about that, that's poor wording on my part.  I don't mean \"CVS\n> won't barf\" -- I meant that GNU Patch can still apply the patch\n> without the meta-data referencing git still.  I think though this\n> \"--no-prefix\" option might just do it.\n\nUpdate your gnu patch. Never versions know how to handle the git \nspecific metadata (gnu patch simply ignores it).\n\nAnd the a/, b/ prefix is *not* git specific. Pretty much all versions of \na patch program know how to deal with that, you just need to use -p1 on \nthe commandline.\n\ntom\n"},{"id":"159222","messageId":"m2k4if9xpl.fsf@igel.home","threadId":"26241","inReplyTo":"AANLkTi=_YdTsvFboQAj447SUtcxrVhM18QkvSVdpvdMJ@mail.gmail.com","subject":"Re: Creating CVS-style patch headers with git-diff","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2011-01-08T16:17:26Z","receivedAt":"2011-01-08T16:17:26Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"David Chanters <david.chanters@googlemail.com> writes:\n\n> Sorry about that, that's poor wording on my part.  I don't mean \"CVS\n> won't barf\" -- I meant that GNU Patch can still apply the patch\n> without the meta-data referencing git still.\n\nSo this has nothing at all to do with CVS.  And GNU patch will happily\nignore everything that it does not recognize.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"159224","messageId":"E49730A5-CD28-4E6F-A655-38505D47897C@dewire.com","threadId":"26241","inReplyTo":"AANLkTinmq=3kJmtSVutf7dHAQ0QL3fr9_E3hZ7gDe1JY@mail.gmail.com","subject":"Re: Creating CVS-style patch headers with git-diff","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2011-01-08T16:35:25Z","receivedAt":"2011-01-08T16:35:25Z","isPatch":false,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"\n8 jan 2011 kl. 12:23 skrev David Chanters:\n\n> Hi all,\n> \n> [ Please Cc me on any replies as I am not subscribed to this list, thanks. ]\n> \n> I am wondering if I can get git diff to create \"CVS-style patches\"?\n> What do I mean by that?  Well, whenever I do:\n> \n> git diff\n> \n> I get patch headers in the form:\n> \n> diff --git a/foo.c b/foo.c\n> index 57b9527..a2d947b 100644\n> --- a/foo.c\n> +++ b/foo.c\n> \n> This is fine for git, but if I then want to import the same patch into\n> CVS I have to either edit the patch, or mess around with the -p option\n> to patch(1).\n> \nAdding -p1 is not what I'd call \"mess around\". It is pretty standard\nuse with patch since most patches has en extra directory level anyway. I\nthink that's why git has those a/ b/ prefixes by default.\n\nHave you tries git cvsexportcommit? It is by far the easiest way of exporting\nfrom git to CVS.\n\n-- robin\n"}]}