Have magit-get-current-remote default to "origin", like Git does.

This commit is contained in:
Nathan Weizenbaum 2010-06-10 16:36:54 -07:00
parent 5744d3ec98
commit db32004209

View file

@ -485,13 +485,20 @@ Many Magit faces inherit from this one by default."
(substring head 11)
nil)))
(defun magit-get-remote (branch)
"Return the name of the remote for BRANCH.
If branch is nil or it has no remote, but a remote named
\"origin\" exists, return that. Otherwise, return nil."
(let ((remote (or (and branch (magit-get "branch" branch "remote"))
(and (magit-get "remote" "origin" "url") "origin"))))
(if (string= remote "") nil remote)))
(defun magit-get-current-remote ()
"Return the name of the remote for the current branch.
If there is no current branch, or no remote for that branch,
return nil."
(let* ((branch (magit-get-current-branch))
(remote (and branch (magit-get "branch" branch "remote"))))
(if (string= remote "") nil remote)))
but a remote named \"origin\" is configured, return that.
Otherwise, return nil."
(magit-get-remote (magit-get-current-branch)))
(defun magit-ref-exists-p (ref)
(= (magit-git-exit-code "show-ref" "--verify" ref) 0))