git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Creating CVS-style patch headers with git-diff
@ 2011-01-08 11:23 David Chanters
  2011-01-08 11:49 ` Tomas Carnecky
  2011-01-08 16:35 ` Robin Rosenberg
  0 siblings, 2 replies; 9+ messages in thread
From: David Chanters @ 2011-01-08 11:23 UTC (permalink / raw)
  To: git; +Cc: David Chanters

Hi all,

[ Please Cc me on any replies as I am not subscribed to this list, thanks. ]

I am wondering if I can get git diff to create "CVS-style patches"?
What do I mean by that?  Well, whenever I do:

git diff

I get patch headers in the form:

diff --git a/foo.c b/foo.c
index 57b9527..a2d947b 100644
--- a/foo.c
+++ b/foo.c

This is fine for git, but if I then want to import the same patch into
CVS I have to either edit the patch, or mess around with the -p option
to patch(1).

I have seen that git-diff has options to change the a/ b/ headers --
can anyone shed some light on this as to what I can do?

The reason I am wanting to do this, is rather than importing
changesets from git -> CVS, I have a git clone outright of a CVS
project (which I update with git-cvsimport) and often want to import
diffs to CVS directly after I'm done, and then I publish my topic
branches in Git when I'm done.  The key thing though is to be able to
apply patches from git -- and I am hoping the easiest thing to do is
to try and get git-diff to change the headers.

Any help greatly received.

Kindly,
David

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Creating CVS-style patch headers with git-diff
  2011-01-08 11:23 Creating CVS-style patch headers with git-diff David Chanters
@ 2011-01-08 11:49 ` Tomas Carnecky
  2011-01-08 13:43   ` David Chanters
  2011-01-08 16:35 ` Robin Rosenberg
  1 sibling, 1 reply; 9+ messages in thread
From: Tomas Carnecky @ 2011-01-08 11:49 UTC (permalink / raw)
  To: David Chanters; +Cc: git

  On 1/8/11 12:23 PM, David Chanters wrote:
> Hi all,
>
> [ Please Cc me on any replies as I am not subscribed to this list, thanks. ]
>
> I am wondering if I can get git diff to create "CVS-style patches"?
> What do I mean by that?  Well, whenever I do:
>
> git diff
>
> I get patch headers in the form:
>
> diff --git a/foo.c b/foo.c
> index 57b9527..a2d947b 100644
> --- a/foo.c
> +++ b/foo.c
>
> This is fine for git, but if I then want to import the same patch into
> CVS I have to either edit the patch, or mess around with the -p option
> to patch(1).
What exactly do you need to change in the patch? Remove the index line? 
The '--git' string? Remove or change the a/, b/ prefix?
> I have seen that git-diff has options to change the a/ b/ headers --
> can anyone shed some light on this as to what I can do?

Are you maybe looking for the --no-prefix option?

tom

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Creating CVS-style patch headers with git-diff
  2011-01-08 11:49 ` Tomas Carnecky
@ 2011-01-08 13:43   ` David Chanters
  2011-01-08 15:21     ` Andreas Schwab
  2011-01-08 15:26     ` Tomas Carnecky
  0 siblings, 2 replies; 9+ messages in thread
From: David Chanters @ 2011-01-08 13:43 UTC (permalink / raw)
  To: Tomas Carnecky; +Cc: git

Hi Tomas,

On 8 January 2011 11:49, Tomas Carnecky <tom@dbservice.com> wrote:
> What exactly do you need to change in the patch? Remove the index line? The
> '--git' string? Remove or change the a/, b/ prefix?

Well, any one of those goals, really.  I just want to generate a patch
that CVS won't barf on -- what that means if not needing to use the
"-p" option to patch because git outputs a/ b/ prefix lines.  Your
"--no-prefix" option does that much, which might be enough.

I did read, I think on this list, that the GNU Patch program
interprets these "diff --git" lines?  What exactly are they for, do
you know?  I mean, even if I just did:

git diff --no-prefix

Would the presense of the other meta-data, such as the "diff --git"
line as well as the "Index" line cause any problems when applying this
patch in CVS (I suppose now, my question doesn't have to apply to CVS
at all, more likely it will apply to any file sets)?  I am not sure
how GNU Patch uses this meta information, and I assume "git diff" adds
it for a good reason.

I hope this all makes sense?

David

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Creating CVS-style patch headers with git-diff
  2011-01-08 13:43   ` David Chanters
@ 2011-01-08 15:21     ` Andreas Schwab
  2011-01-08 15:35       ` David Chanters
  2011-01-08 15:26     ` Tomas Carnecky
  1 sibling, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2011-01-08 15:21 UTC (permalink / raw)
  To: David Chanters; +Cc: Tomas Carnecky, git

David Chanters <david.chanters@googlemail.com> writes:

> Well, any one of those goals, really.  I just want to generate a patch
> that CVS won't barf on

What does "CVS won't barf" mean in this context?  CVS does not operate
on patches.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Creating CVS-style patch headers with git-diff
  2011-01-08 13:43   ` David Chanters
  2011-01-08 15:21     ` Andreas Schwab
@ 2011-01-08 15:26     ` Tomas Carnecky
  1 sibling, 0 replies; 9+ messages in thread
From: Tomas Carnecky @ 2011-01-08 15:26 UTC (permalink / raw)
  To: David Chanters; +Cc: git

  On 1/8/11 2:43 PM, David Chanters wrote:
> Would the presense of the other meta-data, such as the "diff --git"
> line as well as the "Index" line cause any problems when applying this
> patch in CVS (I suppose now, my question doesn't have to apply to CVS

I don't know, you tell me. I've never used CVS.

> at all, more likely it will apply to any file sets)?  I am not sure
> how GNU Patch uses this meta information, and I assume "git diff" adds
> it for a good reason.

gnu patch most likely doesn't use the index line and ignores all the git 
specific additions to the diff format.

tom

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Creating CVS-style patch headers with git-diff
  2011-01-08 15:21     ` Andreas Schwab
@ 2011-01-08 15:35       ` David Chanters
  2011-01-08 15:51         ` Tomas Carnecky
  2011-01-08 16:17         ` Andreas Schwab
  0 siblings, 2 replies; 9+ messages in thread
From: David Chanters @ 2011-01-08 15:35 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Tomas Carnecky, git

On 8 January 2011 15:21, Andreas Schwab <schwab@linux-m68k.org> wrote:
> David Chanters <david.chanters@googlemail.com> writes:
>
>> Well, any one of those goals, really.  I just want to generate a patch
>> that CVS won't barf on
>
> What does "CVS won't barf" mean in this context?  CVS does not operate
> on patches.

Sorry about that, that's poor wording on my part.  I don't mean "CVS
won't barf" -- I meant that GNU Patch can still apply the patch
without the meta-data referencing git still.  I think though this
"--no-prefix" option might just do it.

David

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Creating CVS-style patch headers with git-diff
  2011-01-08 15:35       ` David Chanters
@ 2011-01-08 15:51         ` Tomas Carnecky
  2011-01-08 16:17         ` Andreas Schwab
  1 sibling, 0 replies; 9+ messages in thread
From: Tomas Carnecky @ 2011-01-08 15:51 UTC (permalink / raw)
  To: David Chanters; +Cc: Andreas Schwab, git

  On 1/8/11 4:35 PM, David Chanters wrote:
> Sorry about that, that's poor wording on my part.  I don't mean "CVS
> won't barf" -- I meant that GNU Patch can still apply the patch
> without the meta-data referencing git still.  I think though this
> "--no-prefix" option might just do it.

Update your gnu patch. Never versions know how to handle the git 
specific metadata (gnu patch simply ignores it).

And the a/, b/ prefix is *not* git specific. Pretty much all versions of 
a patch program know how to deal with that, you just need to use -p1 on 
the commandline.

tom

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Creating CVS-style patch headers with git-diff
  2011-01-08 15:35       ` David Chanters
  2011-01-08 15:51         ` Tomas Carnecky
@ 2011-01-08 16:17         ` Andreas Schwab
  1 sibling, 0 replies; 9+ messages in thread
From: Andreas Schwab @ 2011-01-08 16:17 UTC (permalink / raw)
  To: David Chanters; +Cc: Tomas Carnecky, git

David Chanters <david.chanters@googlemail.com> writes:

> Sorry about that, that's poor wording on my part.  I don't mean "CVS
> won't barf" -- I meant that GNU Patch can still apply the patch
> without the meta-data referencing git still.

So this has nothing at all to do with CVS.  And GNU patch will happily
ignore everything that it does not recognize.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Creating CVS-style patch headers with git-diff
  2011-01-08 11:23 Creating CVS-style patch headers with git-diff David Chanters
  2011-01-08 11:49 ` Tomas Carnecky
@ 2011-01-08 16:35 ` Robin Rosenberg
  1 sibling, 0 replies; 9+ messages in thread
From: Robin Rosenberg @ 2011-01-08 16:35 UTC (permalink / raw)
  To: David Chanters; +Cc: git


8 jan 2011 kl. 12:23 skrev David Chanters:

> Hi all,
> 
> [ Please Cc me on any replies as I am not subscribed to this list, thanks. ]
> 
> I am wondering if I can get git diff to create "CVS-style patches"?
> What do I mean by that?  Well, whenever I do:
> 
> git diff
> 
> I get patch headers in the form:
> 
> diff --git a/foo.c b/foo.c
> index 57b9527..a2d947b 100644
> --- a/foo.c
> +++ b/foo.c
> 
> This is fine for git, but if I then want to import the same patch into
> CVS I have to either edit the patch, or mess around with the -p option
> to patch(1).
> 
Adding -p1 is not what I'd call "mess around". It is pretty standard
use with patch since most patches has en extra directory level anyway. I
think that's why git has those a/ b/ prefixes by default.

Have you tries git cvsexportcommit? It is by far the easiest way of exporting
from git to CVS.

-- robin

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-01-08 16:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-08 11:23 Creating CVS-style patch headers with git-diff David Chanters
2011-01-08 11:49 ` Tomas Carnecky
2011-01-08 13:43   ` David Chanters
2011-01-08 15:21     ` Andreas Schwab
2011-01-08 15:35       ` David Chanters
2011-01-08 15:51         ` Tomas Carnecky
2011-01-08 16:17         ` Andreas Schwab
2011-01-08 15:26     ` Tomas Carnecky
2011-01-08 16:35 ` Robin Rosenberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).