diff options
author | Kyle Meyer <kyle@kyleam.com> | 2016-01-28 23:14:22 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2016-01-28 23:14:22 -0500 |
commit | dda8b2d4f5f76c4d83fb2d5ce033f07c688ffa3e (patch) | |
tree | f5df5f9148d90fc014a2890cbf65620de65f1e8c | |
parent | cfbf0675a02e47df401fbe5a20cf95c955cbbc1a (diff) | |
download | emacs.d-dda8b2d4f5f76c4d83fb2d5ce033f07c688ffa3e.tar.gz |
Add magit-describe command
-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 |