summaryrefslogtreecommitdiff
path: root/lisp/km-magit.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/km-magit.el')
-rw-r--r--lisp/km-magit.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/km-magit.el b/lisp/km-magit.el
index 81fa48a..1c84250 100644
--- a/lisp/km-magit.el
+++ b/lisp/km-magit.el
@@ -46,15 +46,19 @@ a proper commit."
(interactive)
(magit-run-git "commit" "--all" "--message=auto"))
-(defun km/magit-update-or-auto-commit ()
- (interactive)
+(defun km/magit-update-or-auto-commit (&optional no-directory)
+ (interactive "P")
(let ((files (delete-dups (nconc (magit-modified-files)
(magit-staged-files)))))
(cl-case (length files)
(0 (user-error "No tracked files with changes"))
(1
(magit-run-git "commit" "--all" "--message"
- (concat (car files) ": Update")))
+ (concat (funcall (if no-directory
+ #'file-name-nondirectory
+ #'identity)
+ (car files))
+ ": Update")))
(t
(km/magit-auto-commit)))))