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

git apply fails because of 'index xxxxxxx..yyyyyyy' line?

From
NYNikita V. Youshchenko <yoush@debian.org>
Date
Feb 12, 2008, 18:55 UTC
Message-ID
<1358330.RVoaTMz8tR@yoush.homelinux.org>
Hello

I was playing with 'git quiltimport' feature, trying to import a large quilt patchset (coming from vendor) into a local git repository containing linux kernel tree.

Some of quilt patches in the patchset have been created by picking single git commits, likely with 'git show XXXXXX > file.patch.

And I found that such patches fail to apply with 'git apply' (which is internally used by 'git quiltimport'). Git complains:

fatal: patch with only garbage at line 3

However, if I edit patch file and add a space before the 'index XXXXXXX..YYYYYYY' in the header, then patch applies cleanly!

Also, some patches did not apply with error message that looked like

error: removal patch leaves file contents error: arch/arm/mm/mmu.c: patch does not apply

But these patches applied cleanly after I addeed a space before 'deleted file mode XXXXXX' lines.

Finally, some patches fauled to apply, with error message
fatal: patch with only garbage at line 3

but applied cleanly after I added a space before 'dissimilarity index XX%' line.

The mentioned addition of spaces do not modify patches themselves. But it makes 'git apply' happy.

I'm confused. Could someone please comment on this? Isn't it a bug in 'git apply'?

Message 1 of 1 in “git apply fails because of 'index xxxxxxx..yyyyyyy' line?”
  1. Nikita V. YoushchenkoFeb 12, 2008

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.