Thread (13 messages) flat view 13 messages, 3 authors, 2016-06-15

Re: being nice to patch(1)

From: Andrew Morton <akpm@linux-foundation.org>
Date: 2016-06-15 22:43:19

On Mon, 2 Jul 2007 14:16:16 -0700 (PDT)
Linus Torvalds [off-list ref] wrote:

On Mon, 2 Jul 2007, Andrew Morton wrote:
quoted
James's current git-scsi-misc has this commit in it:

commit a16efc1cbf0a9e5ea9f99ae98fb774b60d05c35b
Author: Kars de Jong [off-list ref]
Date:   Sun Jun 17 14:47:08 2007 +0200

[SCSI] 53c700: Amiga 4000T NCR53c710 SCSI
    
    New driver for the Amiga 4000T built-in NCR53c710 SCSI controller, using the
    53c700 SCSI core.
    
    Signed-off-by: Geert Uytterhoeven [off-list ref]
    Signed-off-by: James Bottomley [off-list ref]


When one pulls that diff out of git with `git-show' or whatever, it doesn't
work - patch(1) has a heart attack over the "53c700":
There's really nothing git can do about this, this is a patch oddity about 
the free-form message. A really strange one too, because the line is 
literally four spaces followed by the 53c700, and the thing is, that's not 
even a valid olf-fashioned patch (_without_ the four spaces, I could see 
that "patch" might think that it's a really old ed-

I think you have two options:

 - tell patch to take it as a unified diff:

	git show | patch -p1 -u

   should work, since patch won't be trying to figure out what kind of 
   diff it is, and won't think that the 53c700 is some kind of odd ed 
   script.
yup, `patch -u' fixes it up.
 - suppress the free-form messages, by using (for example)

	git show --pretty=oneline | patch -p1

   and now "patch" doesn't get any random commit message except for the 
   first line (which always starts with the SHA1) and hopefully cannot 
   _possibly_ interpret that to be some strange patch format.

Or, of course, just use "git-apply" instead of patch to apply the thing.
Thing is, changelog-followed-by-diff is a fairly standard format used by
quilt and other such toys.

Hopefully quilt is using -u so it won't encounter this oddity.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help