threads / discuss / 1752

git applymbox is too anal

Subject: git applymbox is too anal

## tl;dr

5 messages between Sep 8, 2005 and Sep 9, 2005.

replies: 4people: 3as markdown or json

Greg KH· Sep 8, 2005, 23:25 UTC · lore

Ick. I'm trying to apply a bunch of patches to a git repo (the kernel tree), using 'git applymbox' and it's just dieing on simple patches that apply with fuzz.

for example:
$ git applymbox ~/linux/patches/u07
Applying 'USB: fix up URB_ASYNC_UNLINK usages from the usb-serial drivers'

error: patch failed: drivers/usb/serial/option.c:513 error: drivers/usb/serial/option.c: patch does not apply

$ patch -p1 --dry-run < ~/linux/patches/u07 patching file drivers/usb/serial/keyspan.c patching file drivers/usb/serial/option.c Hunk #3 succeeded at 509 with fuzz 1.

So, I have to then do a 'patch, git diff, git checkout-cache -f -u -a, git applymbox' type dance to get this patch to apply.

Or am I missing some option to 'git applymbox' that I can't seem to find?

thanks,
greg k-h
Greg KH· Sep 8, 2005, 23:39 UTC · re: Greg KH · lore

Re: git applymbox is too anal

On Thu, Sep 08, 2005 at 04:25:35PM -0700, Greg KH wrote:
> Ick.  I'm trying to apply a bunch of patches to a git repo (the kernel
> tree), using 'git applymbox' and it's just dieing on simple patches that
> apply with fuzz.

Ok, found another one. This time I looked at the patch itself, and it is a bit "odd", but normal patch handles it fine.

The patch is: --- gregkh-2.6.orig/drivers/usb/input/Makefile 2005-08-15 23:39:10.000000000 -0700 +++ gregkh-2.6/drivers/usb/input/Makefile 2005-08-16 12:31:54.000000000 -0700

@@ -39,5 +39,6 @@
 obj-$(CONFIG_USB_POWERMATE)    += powermate.o
 obj-$(CONFIG_USB_WACOM)        += wacom.o
 obj-$(CONFIG_USB_ACECAD)       += acecad.o
+obj-$(CONFIG_USB_YEALINK)      += yealink.o
 obj-$(CONFIG_USB_XPAD)         += xpad.o
 obj-$(CONFIG_USB_APPLETOUCH)   += appletouch.o

While the original drivers/usb/input/Makefile in this area is:
obj-$(CONFIG_USB_POWERMATE)     += powermate.o
obj-$(CONFIG_USB_WACOM)         += wacom.o
obj-$(CONFIG_USB_ACECAD)        += acecad.o
obj-$(CONFIG_USB_XPAD)          += xpad.o

(ignore tab issues, this was cut-and-pasted).

So, the patch shows that there was another line at the end of the file,
while in reality it isn't (this is due to me excluding a patch from the
series that I'm applying due to other reasons.)

Is this something that git can handle without me editing the patch by
hand?  :)

thanks,

greg k-h
Junio C Hamano· Sep 9, 2005, 01:03 UTC · re: Greg KH · lore

Re: git applymbox is too anal

Greg KH <greg@kroah.com> writes:
Show 6 quoted lines
> So, the patch shows that there was another line at the end of the file,
> while in reality it isn't (this is due to me excluding a patch from the
> series that I'm applying due to other reasons.)
>
> Is this something that git can handle without me editing the patch by
> hand?  :)

Linus was quite strict about rejecting any fuzz, but I am sympathetic to the cause. I do not mind if somebody comes up with a patch to add '--fuzz' option to git-apply; we can try applying first without --fuzz and ask the user if he wants one from 'git applymbox' main loop when it fails.

Linus Torvalds· Sep 9, 2005, 00:58 UTC · re: Greg KH · lore

Re: git applymbox is too anal

On Thu, 8 Sep 2005, Greg KH wrote:
> 
> Or am I missing some option to 'git applymbox' that I can't seem to
> find?

No. git-apply wants an exact bit-for-bit match. Partly because fuzz is hard, but mostly because I don't like it. I apply a _lot_ of patches, and if a unforgiving "git-apply" works for me, it should work for you too.

One issue is that I want to apply patches that apply cleanly, and if the patch was generated against some older kernel version, then it should quite likely be _applied_ towards that older kernel version. Then you can use git to merge the two.

Of course, I only do that occasionally, for bigger clashes. For smaller things, I just edit the patch by hand. And sometimes, I ask the sending side to re-generate the patch.

Applying with a fuzz does the right thing most of the time. But "most" isn't good enough. I'd rather have a human look at anything that requires fuzz.

		Linus
Greg KH· Sep 9, 2005, 17:07 UTC · re: Linus Torvalds · lore

Re: git applymbox is too anal

On Thu, Sep 08, 2005 at 05:58:18PM -0700, Linus Torvalds wrote:
Show 10 quoted lines
> 
> 
> On Thu, 8 Sep 2005, Greg KH wrote:
> > 
> > Or am I missing some option to 'git applymbox' that I can't seem to
> > find?
> 
> No. git-apply wants an exact bit-for-bit match. Partly because fuzz is 
> hard, but mostly because I don't like it. I apply a _lot_ of patches, and 
> if a unforgiving "git-apply" works for me, it should work for you too.

Ok, as I've been using quilt to stage patches before they are ready to send to you, sometimes, when I build up the final tree, there are tiny fuzz issues. I'll just make sure to fix this up before running applymbox in the future.

thanks,
greg k-h

← back to recent threads