Re: [RFC] solving a bug with hunks starting at line 1 in git apply

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Remi LESPINET <remi.lespinet@xxxxxxxxxxxxxxxxxxxxxxx> writes:
>
>> first original file:
>>
>> 10
>> 20
>> 30
>> 40
>>
>> for the following diff file:
>>
>> @@ -1,2 +1,2 @@
>>  20
>> -30
>> +35
>>  40
>>
>> The patch will not be applied with a git apply command, but it will
>> with a basic patch command.
>
> Doesn't that merely indicate a bug in "patch", though?

No, it's just that patch does a fuzzy match in this case:

$ patch < patch.diff 
patching file pre.txt
Hunk #1 succeeded at 2 with fuzz 1 (offset 1 line).

It's different from the other case:

Remi LESPINET <remi.lespinet@xxxxxxxxxxxxxxxxxxxxxxx> writes:

> @@ -1,1 +1,2 @@
> +5
>  10
> @@ -1,3 +2,3 @@
>  10
> +15
> -20
>  30

With this one, I get:

$ git apply < p2.diff   
error: patch failed: pre.txt:1
error: pre.txt: patch does not apply
$ patch < p2.diff 
patching file pre.txt

=> no fuzzy matching for patch, git apply should actually work.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]