summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.el1
-rw-r--r--lisp/km-magit.el13
2 files changed, 14 insertions, 0 deletions
diff --git a/init.el b/init.el
index bc7ad2c..24245db 100644
--- a/init.el
+++ b/init.el
@@ -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