Commit fa0e336c authored by Jonas Bernoulli's avatar Jonas Bernoulli

Only merge into wipref after commit if any wip mode is enabled

The merging is done using `magit-wip-commit', which does more than
just merge.  It also creates the wipref if it doesn't exist yet and
that is clearly undesirable when the user hasn't enabled any of the
wip modes.
parent aaf7af15
......@@ -496,7 +496,9 @@ This is only used if Magit is available."
(add-hook 'with-editor-pre-cancel-hook
'git-commit-save-message nil t)
(add-hook 'with-editor-post-finish-hook 'git-commit-run-post-finish-hook)
(when (bound-and-true-p magit-wip-merge-branch)
(when (and (bound-and-true-p magit-wip-merge-branch)
(fboundp 'magit-wip-any-enabled-p)
(magit-wip-any-enabled-p))
(add-hook 'with-editor-post-finish-hook
'magit-wip-commit nil t))
(setq with-editor-cancel-message
......
......@@ -350,6 +350,14 @@ commit message."
(concat "refs/heads/" branch))
"HEAD")))
(defun magit-wip-any-enabled-p ()
(or magit-wip-mode
magit-wip-after-save-local-mode
magit-wip-after-save-mode
magit-wip-after-apply-mode
magit-wip-before-change-mode
magit-wip-initial-backup-mode))
;;; Log
(defun magit-wip-log-index (args files)
......
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