OSDN Git Service

git p4: Use git diff-tree instead of format-patch
authorCrestez Dan Leonard <cdleonard@gmail.com>
Thu, 21 Nov 2013 15:19:03 +0000 (17:19 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 22 Nov 2013 23:30:51 +0000 (15:30 -0800)
The output of git format-patch can vary with user preferences. In
particular setting diff.noprefix will break the "git apply" that
is done as part of "git p4 submit".

Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Crestez Dan Leonard <cdleonard@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-p4.py

index 31e71ff..fe988ce 100755 (executable)
--- a/git-p4.py
+++ b/git-p4.py
@@ -1308,7 +1308,7 @@ class P4Submit(Command, P4UserMap):
             else:
                 die("unknown modifier %s for %s" % (modifier, path))
 
-        diffcmd = "git format-patch -k --stdout \"%s^\"..\"%s\"" % (id, id)
+        diffcmd = "git diff-tree -p \"%s\"" % (id)
         patchcmd = diffcmd + " | git apply "
         tryPatchCmd = patchcmd + "--check -"
         applyPatchCmd = patchcmd + "--check --apply -"