Function: magit-get-next-tag

magit-get-next-tag is a byte-compiled function defined in magit-git.el.

Signature

(magit-get-next-tag &optional REV WITH-DISTANCE)

Documentation

Return the closest tag from which REV is reachable.

If optional REV is nil, then default to HEAD. If no such tag can be found or if the distance is 0 (in which case it is the current tag, not the next), return nil instead. If optional WITH-DISTANCE is non-nil, then return (TAG COMMITS) where COMMITS is the number of commits in TAG but not in REV.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-git.el
(defun magit-get-next-tag (&optional rev with-distance)
  "Return the closest tag from which REV is reachable.

If optional REV is nil, then default to `HEAD'.
If no such tag can be found or if the distance is 0 (in which
case it is the current tag, not the next), return nil instead.
If optional WITH-DISTANCE is non-nil, then return (TAG COMMITS)
where COMMITS is the number of commits in TAG but not in REV."
  (and-let ((str (magit-git-str "describe" "--contains" (or rev "HEAD"))))
    (save-match-data
      (when (string-match "^[^^~]+" str)
        (setq str (match-str 0 str))
        (unless (equal str (magit-get-current-tag rev))
          (if with-distance
              (list str (car (magit-rev-diff-count str rev)))
            str))))))