Have magit-get-current-remote default to "origin", like Git does.
This commit is contained in:
parent
5744d3ec98
commit
db32004209
1 changed files with 11 additions and 4 deletions
15
magit.el
15
magit.el
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue