1

I have a multi-file patch and ediff-patch-file doesn't find the files unless I manually remove all of the "a/" and "b/" prefixes from the patch first. In other words, it acts like "patch -p0" when I want "patch -p1". How do I tell ediff to do what I want?

Example:

diff --git a/src/java/main/com/example/player/PlayerApplication.java b/src/java/main/com/example/player/PlayerApplication.java
--- a/src/java/main/com/example/player/PlayerApplication.java
+++ b/src/java/main/com/example/player/PlayerApplication.java
@@ -907,6 +907,7 @@

Version: GNU Emacs 24.5.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21)

1 Answer 1

2

If you read the code of ediff-patch-file, you will find it calls ediff-patch-file-internal which basically just calls GNU Patch (https://www.gnu.org/software/diffutils/manual/html_node/patch-Options.html)

Here is code quoted from ediff-patch-file-internal:

(call-process-region
 (point-min) (point-max)
 shell-file-name
 t   ; delete region (which contains the patch
 t   ; insert output (patch diagnostics) in current buffer
 nil ; don't redisplay
 shell-command-switch   ; usually -c
 (format "%s %s %s %s"
     ediff-patch-program
     ediff-patch-options
     ediff-backup-specs
     (expand-file-name true-source-filename))
 ))

You can tweak ediff-patch-options whose default value is "-f".

So the easiest setup is (setq ediff-patch-options "-f -p1").

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.