Subject: bug#26028: 26.0.50; epatch for multifile patches

From: Arseny Sher <[email-masked]>
Date: Thu, 09 Mar 2017 14:44:11 +0300

Tino Calancha <[email-masked]> writes:

>> How should I apply tmp.patch to proj?
> Ediff uses the `default-directory' for the patch buffer as a hint.
> When i apply patches generated with VCS i _always_ set the
> `default-directory' of the patch buffer equal as the root directory of
> the project.  That makes multi patches work OK.
> This is how i would do in your exmple:
> M-: (dired "/tmp/proj") RET
> C-x b *p* RET ; Now copy the patch here in your favourite way.
> C-x 4 r /tmp/tmp.patch RET
> C-x h M-w C-x o C-y
> M-x epatch RET y *p* RET /tmp/proj/src RET

Honestly, I didn't understand your answer.
1) I don't see any effects of changing the default directory. I set
   default directory of buffer with patch to ~/tmp/proj as you say, then
   run epatch, firstly point it to this buffer, then specify ~/tmp/proj
   (because this is project root, and I want to patch the whole project!)
   as target directory and it fails again, exactly as before.
2) Interpreting your instructions literally, I should specify
   ~/tmp/proj/src as target directory to ediff (answer to its last
   question). Well, then it works, but this is precisely the behaviour
   which doesn't make any sense to me: ediff just ignores the path to
   file ('src' directory here). And it happens totally independent of
   default directory value, I tried with different ones.
   I suppose that the whole point of applying multifile patch is to allow
   ediff deduce which files (with full paths) it needs to patch
   automatically, without manually specifying dirs like 'src'. Imagine
   we have also hello.h file under proj/include; then, if I tell ediff
   to use ~/tmp/proj/src dir as target directory as you say, it will
   successfully patch hello.c, but it will fail again attempting to
   patch hello.h, because there is no such file proj/src/hello.h.

So, it is hard for me to suggest better epatch behaviour because I
actually don't comprehend its current one. I don't know why other people
don't encounter these problems. Probably they just apply patches via git
and only then look at the diff via ediff, and I should go the same
way...