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

Re: BUG?: git-apply sometimes says "corrupt patch" when adding single lines

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Aug 17, 2010, 23:43 UTC
Message-ID
<20100817234314.GK2221@burratino>
In-Reply-To
<AANLkTineHiG9vCpbJzJ2x9CFjZ7LQeExs7cN5YhoZhft@mail.gmail.com>
Tor Arvid Lund wrote:
Show 12 quoted lines
> I don't really know the git-gui code or the git C code well, but it
> seems that I got around the error with this small patch:
> 
> diff --git a/builtin/apply.c b/builtin/apply.c
> index 12ef9ea..124791f 100644
> --- a/builtin/apply.c
> +++ b/builtin/apply.c
> @@ -1335,6 +1335,8 @@ static int parse_fragment(char *line, unsigned long size,
>  		 * l10n of "\ No newline..." is at least that long.
>  		 */
>  		case '\\':
> +			if (newlines == oldlines == 1)
[...]

Heh. This code is a roundabout way to say "if (newlines == oldlines)", rather than "if (newlines == 1 && oldlines == 1)" that might have been intended.

Unfortunately I do not have any more insight than that. If you can give an example reproducing this with git apply from the command line, that would be very helpful.

Thanks, Jonathan

Previous: Tor Arvid LundNext: Tor Arvid Lund
Message 2 of 5 in “BUG?: git-apply sometimes says "corrupt patch" when adding single lines”
  1. Tor Arvid LundAug 17, 2010
  2. Jonathan NiederAug 17, 2010
  3. Tor Arvid LundAug 18, 2010
  4. Johannes SixtAug 18, 2010
  5. Tor Arvid LundAug 18, 2010

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.