From 559288e7099f8bc4db0d7a415da449c754326b5b Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Thu, 16 Apr 2020 23:46:38 -0400 Subject: km/magit-show-commit-at-point: Recognize 'git describe' format --- lisp/km-magit.el | 10 +++++++--- 1 file 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. + (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)) -- cgit v1.2.3