git-p4: format-patch to diff-tree change breaks binary patches
authorTolga Ceylan <tolga.ceylan@gmail.com>
Wed, 7 May 2014 05:48:54 +0000 (22:48 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 7 May 2014 17:27:22 +0000 (10:27 -0700)
When applying binary patches a full index is required. format-patch
already handles this, but diff-tree needs '--full-index' argument
to always output full index. When git-p4 runs git-apply to test
the patch, git-apply rejects the patch due to abbreviated blob
object names. This is the error message git-apply emits in this
case:

error: cannot apply binary patch to '<filename>' without full index line
error: <filename>: patch does not apply

Signed-off-by: Tolga Ceylan <tolga.ceylan@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-p4.py
index fe988cec49b865a24ea9445b28544baa964138db..17760c73e5628ed197eb7841a6cfc2a8fd1b3137 100755 (executable)
--- a/git-p4.py
+++ b/git-p4.py
@@ -1308,7 +1308,7 @@ def applyCommit(self, id):
             else:
                 die("unknown modifier %s for %s" % (modifier, path))
 
-        diffcmd = "git diff-tree -p \"%s\"" % (id)
+        diffcmd = "git diff-tree --full-index -p \"%s\"" % (id)
         patchcmd = diffcmd + " | git apply "
         tryPatchCmd = patchcmd + "--check -"
         applyPatchCmd = patchcmd + "--check --apply -"