branch: elpa/magit
commit 2ecd34364ff46b12502986233d8a501d361040d1
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-wip-mode: Add to git-commit-post-finish-hook globally
---
lisp/git-commit.el | 4 +---
lisp/magit-wip.el | 14 ++++++++------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/lisp/git-commit.el b/lisp/git-commit.el
index 0bcad3d3473..ab4d9cc926b 100644
--- a/lisp/git-commit.el
+++ b/lisp/git-commit.el
@@ -596,9 +596,7 @@ Used as the local value of `header-line-format', in buffer
using
(add-hook 'with-editor-post-finish-hook
(apply-partially #'git-commit-run-post-finish-hook
(magit-rev-parse "HEAD"))
- nil t)
- (when (fboundp 'magit-wip-maybe-add-commit-hook)
- (magit-wip-maybe-add-commit-hook)))
+ nil t))
(setq with-editor-cancel-message
#'git-commit-cancel-message)
(git-commit-setup-font-lock)
diff --git a/lisp/magit-wip.el b/lisp/magit-wip.el
index eed16d5f512..e78c2e1e319 100644
--- a/lisp/magit-wip.el
+++ b/lisp/magit-wip.el
@@ -87,12 +87,14 @@ is used as `branch-ref'."
(add-hook 'after-save-hook #'magit-wip-commit-buffer-file)
(add-hook 'magit-after-apply-functions #'magit-wip-commit)
(add-hook 'magit-before-change-functions #'magit-wip-commit)
- (add-hook 'before-save-hook #'magit-wip-commit-initial-backup))
+ (add-hook 'before-save-hook #'magit-wip-commit-initial-backup)
+ (add-hook 'git-commit-post-finish-hook #'magit-wip-commit-post-editmsg))
(t
(remove-hook 'after-save-hook #'magit-wip-commit-buffer-file)
(remove-hook 'magit-after-apply-functions #'magit-wip-commit)
(remove-hook 'magit-before-change-functions #'magit-wip-commit)
- (remove-hook 'before-save-hook #'magit-wip-commit-initial-backup))))
+ (remove-hook 'before-save-hook #'magit-wip-commit-initial-backup)
+ (remove-hook 'git-commit-post-finish-hook
#'magit-wip-commit-post-editmsg))))
(defun magit-wip-commit-buffer-file (&optional msg)
"Commit visited file to a worktree work-in-progress ref."
@@ -129,6 +131,10 @@ is used as `branch-ref'."
(magit-wip-commit-buffer-file "autosave %s before save"))
(setq magit-wip-buffer-backed-up t)))
+(defun magit-wip-commit-post-editmsg ()
+ (when magit-wip-merge-branch
+ (magit-wip-commit)))
+
;;; Core
(defun magit-wip-commit (&optional files msg)
@@ -239,10 +245,6 @@ commit message."
(concat "refs/heads/" branch))
"HEAD")))
-(defun magit-wip-maybe-add-commit-hook ()
- (when (and magit-wip-mode magit-wip-merge-branch)
- (add-hook 'git-commit-post-finish-hook #'magit-wip-commit nil t)))
-
;;; Log
(defun magit-wip-log-index (args files)