Skip to contentSkip to conversation

git apply-diff / am cannot deal with patches generated with git diff/format-patch --noprefix?

DISCUSSION marcel partap 2 participants 2 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

...at least it seems so. -p0 does not help:

Quoted 1 line

fatal: git apply: bad git-diff - inconsistent old filename on line xx

So it is not possible to have diff.noprefix set as default and generate patches that can be circulated? Or am i missing something there? #regards/marcel

#1 lore raw
Quoted 2 lines · marcel partap

...at least it seems so. -p0 does not help:

Quoted 1 line

fatal: git apply: bad git-diff - inconsistent old filename on line xx

Hmm, does not reproduce for me.

$ git checkout v1.7.6 ;# or whatever random commit I had at hand
$ git show --no-prefix >P.diff
$ grep "^diff --git" P.diff
Documentation/RelNotes/1.7.6.txt +0 -0
Documentation/git.txt +0 -0
GIT-VERSION-GEN +0 -0
$ git checkout HEAD^
$ git apply -p0 <P.diff
$ git diff v1.7.6 ; echo nothing
nothing
$ git diff --stat
 Documentation/RelNotes/1.7.6.txt |    8 +-------
 Documentation/git.txt            |    5 +++++
 GIT-VERSION-GEN                  |    2 +-
 3 files changed, 7 insertions(+), 8 deletions(-)