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, 17:16 UTC
Message-ID
<xmqqiob773iy.fsf@gitster.dls.corp.google.com>
In-Reply-To
<87k2vnqrv8.fsf@ensimag.grenoble-inp.fr>
Remi LESPINET <remi.lespinet@ensimag.grenoble-inp.fr> writes:
Show 17 quoted lines
> 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?

The patch text says that the preimage must begin with "20" but the target begins with "10".

I think we have the same "the boundary must match" logic not just at the beginning of the file but also at the end of the file. No matter what the answer to the above question is, we would need to do the same for both the beginning and the end, I would think.

Thanks.
Previous: Remi LESPINETNext: Junio C Hamano
Message 2 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.