Function: magit-ref-maybe-qualify

magit-ref-maybe-qualify is a byte-compiled function defined in magit-git.el.

Signature

(magit-ref-maybe-qualify REFNAME &optional PREFIX)

Documentation

If REFNAME is ambiguous, try to disambiguate it by prepend PREFIX to it.

Return an unambiguous refname, either REFNAME or that prefixed with PREFIX, nil otherwise. If REFNAME has an offset suffix such as "~1", then that is preserved. If optional PREFIX is nil, then use "heads/".

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-git.el
(defun magit-ref-maybe-qualify (refname &optional prefix)
  "If REFNAME is ambiguous, try to disambiguate it by prepend PREFIX to it.
Return an unambiguous refname, either REFNAME or that prefixed
with PREFIX, nil otherwise.  If REFNAME has an offset suffix
such as \"~1\", then that is preserved.  If optional PREFIX is
nil, then use \"heads/\"."
  (if (magit-ref-ambiguous-p refname)
      (let ((refname (concat (or prefix "heads/") refname)))
        (and (not (magit-ref-ambiguous-p refname)) refname))
    refname))