summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2020-04-16 23:46:38 -0400
committerKyle Meyer <kyle@kyleam.com>2020-04-16 23:54:15 -0400
commit559288e7099f8bc4db0d7a415da449c754326b5b (patch)
tree4f3e4afb3d78a37e1497abd9e11decc1f8941b42
parentc13260a31901641b022e97bc194c6a7d0e54ff8e (diff)
downloademacs.d-559288e7099f8bc4db0d7a415da449c754326b5b.tar.gz
km/magit-show-commit-at-point: Recognize 'git describe' format
-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 c8b855a..38fe1cb 100644
--- a/lisp/km-magit.el
+++ b/lisp/km-magit.el
@@ -73,10 +73,14 @@ project, or 3) an commit object for the hash at point doesn't
exist in the current project."
(interactive "P")
(if (save-excursion (skip-chars-backward "[[:xdigit:]]")
- (looking-at (rx word-boundary
- (repeat 4 40 xdigit)
+ ;; Handle git-describe's *-g<hexsha>.
+ (when (and (equal (char-after (- (point) 1)) ?g)
+ (equal (char-after (- (point) 2)) ?-))
+ (forward-char -2))
+ (looking-at (rx (or word-boundary "-g")
+ (group (repeat 4 40 xdigit))
word-boundary)))
- (let* ((hash (match-string-no-properties 0))
+ (let* ((hash (match-string-no-properties 1))
(project
(and (or choose-project
(not (projectile-project-p))