Skip to content

Commit

Permalink
magit-ref-maybe-qualify: new function
Browse files Browse the repository at this point in the history
This pattern will be used in several places as we deal with ambiguous
refname issues.
  • Loading branch information
kyleam committed Jun 10, 2017
1 parent 7026b9b commit dfa440f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lisp/magit-git.el
Expand Up @@ -851,6 +851,12 @@ string \"true\", otherwise return nil."
(defun magit-ref-ambiguous-p (name)
(not (magit-ref-fullname name)))

(cl-defun magit-ref-maybe-qualify (name &optional (prefix "heads/"))
"If NAME is ambiguous, prepend PREFIX to it."
(concat (and (magit-ref-ambiguous-p name)
prefix)
name))

(defun magit-ref-exists-p (ref)
(magit-git-success "show-ref" "--verify" ref))

Expand Down

0 comments on commit dfa440f

Please sign in to comment.