I'm getting this error when trying to apply a patch using git am:
error: git diff header lacks filename information
when removing 1 leading pathname component (line 9)
The patch was created using git's own format-patch command and not edited in any way, what's wrong?
It should no longer be an issue:
With Git 2.41 (Q2 2023), "
git format-patch"(man) honors thesrc/dstprefixes set to nonstandard values with configuration variables likediff.noprefix, causing the receiving end of the patch that expects the standard-p1format to break.Teach "
format-patch" to ignore end-user configuration and always use the standard prefixes.This is a backward compatibility breaking change.
See commit ab89575 (13 Mar 2023), and commit 8d5213d, commit c169af8, commit b39a569, commit 7c03d0d, commit 6799aad (09 Mar 2023) by Jeff King (
peff).(Merged by Junio C Hamano --
gitster-- in commit 15108de, 21 Mar 2023)And:
git confignow includes in its man page: