branch: elpa/magit
commit 0ecb7820a2525967680c3eb1d1c837d53e646c95
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-wip--commitable-p: New function
---
lisp/magit-wip.el | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/lisp/magit-wip.el b/lisp/magit-wip.el
index 0968c13de0..7a68cb7c5f 100644
--- a/lisp/magit-wip.el
+++ b/lisp/magit-wip.el
@@ -131,10 +131,7 @@ buffer."
(defun magit-wip-commit-buffer-file (&optional msg)
"Commit visited file to a worktree work-in-progress ref."
(interactive (list "save %s snapshot"))
- (when (and (not magit--wip-inhibit-autosave)
- buffer-file-name
- (magit-inside-worktree-p t)
- (magit-file-tracked-p buffer-file-name))
+ (when (magit-wip--commitable-p)
(magit-wip-commit-worktree
(magit-wip-get-ref)
(list buffer-file-name)
@@ -155,10 +152,7 @@ buffer."
(put 'magit-wip-buffer-backed-up 'permanent-local t)
(defun magit-wip-commit-initial-backup ()
- (when (and (not magit-wip-buffer-backed-up)
- buffer-file-name
- (magit-inside-worktree-p t)
- (magit-file-tracked-p buffer-file-name))
+ (when (magit-wip--commitable-p)
(let ((magit-save-repository-buffers nil))
(magit-wip-commit-buffer-file "autosave %s before save"))
(setq magit-wip-buffer-backed-up t)))
@@ -293,6 +287,12 @@ commit message."
(concat "refs/heads/" branch))
"HEAD")))
+(defun magit-wip--commitable-p ()
+ (and (not magit--wip-inhibit-autosave)
+ buffer-file-name
+ (magit-inside-worktree-p t)
+ (magit-file-tracked-p buffer-file-name)))
+
;;; Log
(defun magit-wip-log-index (args files)