Commit a94bc130 authored by Jonas Bernoulli's avatar Jonas Bernoulli

Do not merge into wipref when continuing a sequence

Running a command like "git rebase --continue" can result in the user
being asked to edit a commit message.  When the user confirms the
message then `with-editor-post-finish-hook' is run. `magit-wip-commit'
may be a member of that hook.

Trying to commit to the wipref is unsafe when "git rebase" is running.
It may result in "git rebase" failing because we hold the index.look,
or committing failing because some child of "git rebase" does so.

Teach `magit-wip-maybe-add-commit-hook', which is responsible for
adding that function when appropriate, to not do so when the commit
was initiated by a command that calls a "git" command that does other
things after creating the commit.
parent 9ba9ab0b
......@@ -344,6 +344,7 @@ depending on the value of option `magit-commit-squash-confirm'."
((and (magit-rebase-in-progress-p)
(not (magit-anything-unstaged-p))
(y-or-n-p "Nothing staged. Continue in-progress rebase? "))
(setq this-command 'magit-rebase-continue)
(magit-run-git-sequencer "rebase" "--continue")
((and (file-exists-p (magit-git-dir "MERGE_MSG"))
......@@ -353,7 +353,13 @@ commit message."
(defun magit-wip-maybe-add-commit-hook ()
(when (and magit-wip-merge-branch
(memq last-command
(add-hook 'with-editor-post-finish-hook 'magit-wip-commit nil t)))
(defun magit-wip-any-enabled-p ()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment