Function: magit-get-shortname

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

Signature

(magit-get-shortname REV)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-git.el
(defun magit-get-shortname (rev)
  (let* ((fn (apply-partially #'magit-rev-name rev))
         (name (or (funcall fn "refs/tags/*")
                   (funcall fn "refs/heads/*")
                   (funcall fn "refs/remotes/*"))))
    (cond ((not name)
           (magit-rev-parse "--short" rev))
          ((string-match "^\\(?:tags\\|remotes\\)/\\(.+\\)" name)
           (if (magit-ref-ambiguous-p (match-str 1 name))
               name
             (match-str 1 name)))
          ((magit-ref-maybe-qualify name)))))