branch: externals/debbugs
commit c8e310060c2807d2404430f1547c99a4c1418fb3
Author: Lars Ingebrigtsen <[email protected]>
Commit: Lars Ingebrigtsen <[email protected]>
If there are multiple patches, collect the .rej from all of them
---
debbugs-gnu.el | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/debbugs-gnu.el b/debbugs-gnu.el
index 4516423..f2179f7 100644
--- a/debbugs-gnu.el
+++ b/debbugs-gnu.el
@@ -2421,13 +2421,25 @@ If SELECTIVELY, query the user before applying the
patch."
(y-or-n-p (format "%s\nApply?"
(buffer-substring (point-min)
(min 200 (point-max))))))
- (call-process-region (point-min) (point-max)
- "patch" nil output-buffer nil
- "-r" rej "--no-backup-if-mismatch"
- "-l" "-f"
- "-d" (expand-file-name
- debbugs-gnu-current-directory)
- "-p1"))))
+ (let (old-rej)
+ (when (file-exists-p rej)
+ (with-temp-buffer
+ (insert-file-contents rej)
+ (setq old-rej (buffer-string)))
+ (delete-file rej))
+ (call-process-region (point-min) (point-max)
+ "patch" nil output-buffer nil
+ "-r" rej "--no-backup-if-mismatch"
+ "-l" "-f"
+ "-d" (expand-file-name
+ debbugs-gnu-current-directory)
+ "-p1")
+ (when old-rej
+ (with-temp-buffer
+ (insert old-rej)
+ (when (file-exists-p rej)
+ (insert-file-contents rej))
+ (write-region (point-min) (point-max) rej nil 'silent)))))))
(set-buffer output-buffer)
(when (file-exists-p rej)
(goto-char (point-max))