git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 1, 2015, 18:37 UTC
Message-ID
<xmqqpp5f5l7v.fsf@gitster.dls.corp.google.com>
In-Reply-To
<vpqa8wj48c1.fsf@anie.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 18 quoted lines
>> @@ -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.

I am not sure what you are trying to do with that patch that tries to touch the same line twice. Is this the same old laziness coming back to bite us, the one that we attempted to work around with 933e44d3 ("add -p": work-around an old laziness that does not coalesce hunks, 2011-04-06)?

In other words, isn't the right fix to coalesce that input, so that the second hunk does *not* require fuzzy application in the first place?

Previous: Matthieu MoyNext: Matthieu Moy
Message 5 of 9 in “[RFC] solving a bug with hunks starting at line 1 in git apply”
  1. Remi LESPINETJun 1, 2015
  2. Junio C HamanoJun 1, 2015
  3. Junio C HamanoJun 1, 2015
  4. Matthieu MoyJun 1, 2015
  5. Junio C HamanoJun 1, 2015
  6. Matthieu MoyJun 1, 2015
  7. Junio C HamanoJun 1, 2015
  8. Remi LespinetJun 1, 2015
  9. Matthieu MoyJun 1, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.