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

git-am cannot apply git format-patch -M

From
Maarten Billemont <lhunath@gmail.com>
Date
Mar 28, 2011, 07:44 UTC
Message-ID
<09D72CB4-1B48-4799-B0D5-DB54942D840F@gmail.com>
I've created a series of patches for my local commits using:
git format-patch -M -C ...
The resulting patch files contain hunks like:
diff --git a/file1 b/file2
similarity index 93% 
rename from file1
rename to file2
index 7cf3a09..88c9c13 100644
--- a/file1
+++ b/file2
[...]

git-am fails at applying these hunks, failing with:

Applying: [commit description]
fatal: git apply: bad git-diff - inconsistent old filename on line 109
Patch failed at [HEAD commit]
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".

Additionally, I'd like to report that the line number reported by git-am in this error message does not reflect the actual line number of the problem in the patch file.  The reported line number is offset by -[amount of lines before the [---] line in the patch file], which makes understanding the error message hard, confusing and potentially misleading.
Next: Jeff King
Message 1 of 2 in “git-am cannot apply git format-patch -M”
  1. Maarten BillemontMar 28, 2011
  2. Jeff KingMar 28, 2011

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.