diff options
Diffstat (limited to 'remote.c')
-rw-r--r-- | remote.c | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -1721,18 +1721,25 @@ const char *branch_get_upstream(struct branch *branch, struct strbuf *err) { if (!branch) return error_buf(err, _("HEAD does not point to a branch")); - if (!branch->merge || !branch->merge[0] || !branch->merge[0]->dst) { + + if (!branch->merge || !branch->merge[0]) { + /* + * no merge config; is it because the user didn't define any, + * or because it is not a real branch, and get_branch + * auto-vivified it? + */ if (!ref_exists(branch->refname)) return error_buf(err, _("no such branch: '%s'"), branch->name); - if (!branch->merge) - return error_buf(err, - _("no upstream configured for branch '%s'"), - branch->name); + return error_buf(err, + _("no upstream configured for branch '%s'"), + branch->name); + } + + if (!branch->merge[0]->dst) return error_buf(err, _("upstream branch '%s' not stored as a remote-tracking branch"), branch->merge[0]->src); - } return branch->merge[0]->dst; } |