Function: magit-get-current-tag
magit-get-current-tag is a byte-compiled function defined in
magit-git.el.
Signature
(magit-get-current-tag &optional REV WITH-DISTANCE)
Documentation
Return the closest tag reachable from REV.
If optional REV is nil, then default to HEAD.
If optional WITH-DISTANCE is non-nil then return (TAG COMMITS),
if it is dirty return (TAG COMMIT DIRTY). COMMITS is the number
of commits in HEAD but not in TAG and DIRTY is t if there are
uncommitted changes, nil otherwise.
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-git.el
(defun magit-get-current-tag (&optional rev with-distance)
"Return the closest tag reachable from REV.
If optional REV is nil, then default to `HEAD'.
If optional WITH-DISTANCE is non-nil then return (TAG COMMITS),
if it is `dirty' return (TAG COMMIT DIRTY). COMMITS is the number
of commits in `HEAD' but not in TAG and DIRTY is t if there are
uncommitted changes, nil otherwise."
(and-let ((str (magit-git-str "describe" "--long" "--tags"
(and (eq with-distance 'dirty) "--dirty")
rev)))
(save-match-data
(string-match
"\\(.+\\)-\\(?:0[0-9]*\\|\\([0-9]+\\)\\)-g[0-9a-z]+\\(-dirty\\)?$" str)
(if with-distance
`(,(match-str 1 str)
,(string-to-number (or (match-str 2 str) "0"))
,@(and (match-str 3 str) (list t)))
(match-str 1 str)))))