diff options
-rw-r--r-- | init.el | 1 | ||||
-rw-r--r-- | lisp/km-magit.el | 13 |
2 files changed, 14 insertions, 0 deletions
@@ -896,6 +896,7 @@ ("n" . km/magit-shorten-hash-at-point) ("p" . km/magit-pin-file) ("r" . km/magit-find-recently-changed-file) + ("t" . km/magit-describe) ("u" . km/magit-auto-commit) ("v" . km/magit-revfile-reset)) :config diff --git a/lisp/km-magit.el b/lisp/km-magit.el index 6c4ed39..9544e1d 100644 --- a/lisp/km-magit.el +++ b/lisp/km-magit.el @@ -500,6 +500,19 @@ function." 'km/magit-copy-hook current-prefix-arg)) (magit-copy-section-value))) +(defun km/magit-describe (rev) + "Run 'git describe' on REV." + (interactive + (list (or (-when-let (section (magit-current-section)) + (cond + ((memq (magit-section-type section) '(commit branch)) + (magit-section-value section)) + ((derived-mode-p 'magit-revision-mode) + (car magit-refresh-args)))) + (magit-read-branch-or-commit "Revision")))) + (--when-let (and rev (magit-git-string "describe" rev)) + (kill-new (message it)))) + (defun km/magit-rev-ancestor-p (rev-a rev-b) "Report whether REV-A is the ancestor of REV-B. Use the revision at point as REV-B. With prefix argument or if |