diff options
| -rw-r--r-- | docs/RelNotes/4.0.0.org | 4 | ||||
| -rw-r--r-- | lisp/magit-sequence.el | 27 |
2 files changed, 21 insertions, 10 deletions
diff --git a/docs/RelNotes/4.0.0.org b/docs/RelNotes/4.0.0.org index 3ba3e65..2af6261 100644 --- a/docs/RelNotes/4.0.0.org +++ b/docs/RelNotes/4.0.0.org @@ -223,6 +223,10 @@ f9ae2a6306 #4620 magit-blame--make-highlight-overlay: Add only to intended line mode change and point is on the file or the mode change section. #4623 +- If applying a patch series with ~git am~ failed, the status buffer + incorrectly repeated already applied patches in the list of + remaining patches. #5024 + 10b5407131 magit-diff-highlight-list: Ensure delayed highlighting takes place b32521d543 magit-ediff-read-files: Handle renames in one-file logs 94aca04dc8 magit-module-section: Use correct keymap diff --git a/lisp/magit-sequence.el b/lisp/magit-sequence.el index 2b210a5..5a8b66b 100644 --- a/lisp/magit-sequence.el +++ b/lisp/magit-sequence.el @@ -914,24 +914,31 @@ If no such sequence is in progress, do nothing." (when (magit-am-in-progress-p) (magit-insert-section (rebase-sequence) (magit-insert-heading "Applying patches") - (let ((patches (nreverse (magit-rebase-patches))) - patch commit) - (while patches + (let* ((patches (nreverse (magit-rebase-patches))) + (dir (expand-file-name "rebase-apply" (magit-gitdir))) + (i (string-to-number + (magit-file-line (expand-file-name "last" dir)))) + (cur (string-to-number + (magit-file-line (expand-file-name "next" dir)))) + patch commit) + (while (and patches (>= i cur)) (setq patch (pop patches)) (setq commit (magit-commit-p (cadr (split-string (magit-file-line patch))))) - (cond ((and commit patches) + (cond ((and commit (= i cur)) (magit-sequence-insert-commit - "pick" commit 'magit-sequence-pick)) - (patches + "stop" commit 'magit-sequence-stop)) + ((= i cur) (magit-sequence-insert-am-patch - "pick" patch 'magit-sequence-pick)) + "stop" patch 'magit-sequence-stop)) (commit - (magit-sequence-insert-sequence commit "ORIG_HEAD")) + (magit-sequence-insert-commit + "pick" commit 'magit-sequence-pick)) (t (magit-sequence-insert-am-patch - "stop" patch 'magit-sequence-stop) - (magit-sequence-insert-sequence nil "ORIG_HEAD"))))) + "pick" patch 'magit-sequence-pick))) + (cl-decf i))) + (magit-sequence-insert-sequence nil "ORIG_HEAD") (insert ?\n)))) (defun magit-sequence-insert-am-patch (type patch face) |
