Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

deal with only one of branch.b.remote or branch.b.merge being defined #509

Merged
merged 2 commits into from

2 participants

@tarsius
Owner

No description provided.

tarsius added some commits
@tarsius tarsius magit-remote-branch-for: deal with branch.b.remote being undefined
If branch.b.remote is undefined return nil just as we already do if
branch.b.merge is undefined.  We could instead default to the local
repository (".") but git itself also does not do that.
0d637c8
@tarsius tarsius magit-remote-string: check whether remote-branch is non-nil
Otherwise return nil.  Previously this attempted to propertize nil.
9c6f2d5
@sigma sigma merged commit 9c6f2d5 into magit:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 21, 2012
  1. @tarsius

    magit-remote-branch-for: deal with branch.b.remote being undefined

    tarsius authored
    If branch.b.remote is undefined return nil just as we already do if
    branch.b.merge is undefined.  We could instead default to the local
    repository (".") but git itself also does not do that.
  2. @tarsius

    magit-remote-string: check whether remote-branch is non-nil

    tarsius authored
    Otherwise return nil.  Previously this attempted to propertize nil.
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 15 deletions.
  1. +13 −15 magit.el
View
28 magit.el
@@ -3478,15 +3478,16 @@ for this argument.)"
"Guess the remote branch name that LOCAL-BRANCH is tracking.
Gives a fully qualified name (e.g., refs/remotes/origin/master) if
FULLY-QUALIFIED-NAME is non-nil."
- (let ((merge (magit-get "branch" local-branch "merge")))
+ (let ((merge (magit-get "branch" local-branch "merge"))
+ (remote (magit-get "branch" local-branch "remote")))
(save-match-data
- (if (and merge (string-match "^refs/heads/\\(.+\\)" merge))
- (concat (if fully-qualified-name
- (let ((remote-name (magit-get "branch" local-branch "remote")))
- (if (string= "." remote-name)
- "refs/heads/"
- (concat "refs/remotes/" remote-name "/"))))
- (match-string 1 merge))))))
+ (when (and merge remote
+ (string-match "^refs/heads/\\(.+\\)" merge))
+ (concat (when fully-qualified-name
+ (if (string= "." remote)
+ "refs/heads/"
+ (concat "refs/remotes/" remote "/")))
+ (match-string 1 merge))))))
;;; Status
@@ -3494,20 +3495,17 @@ FULLY-QUALIFIED-NAME is non-nil."
(defun magit-remote-string (remote remote-branch remote-rebase)
(cond
- ((string= "." remote)
+ ((and (string= "." remote) remote-branch)
(concat
(when remote-rebase "onto ")
"branch "
(propertize remote-branch 'face 'magit-branch)))
- (remote
+ ((and remote remote-branch)
(concat
(when remote-rebase "onto ")
(propertize remote-branch 'face 'magit-branch)
- " @ "
- remote
- " ("
- (magit-get "remote" remote "url")
- ")"))
+ " @ " remote
+ " (" (magit-get "remote" remote "url") ")"))
(t
(run-hook-with-args-until-success 'magit-remote-string-hook))))
Something went wrong with that request. Please try again.