summaryrefslogtreecommitdiff
path: root/sha1_name.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2012-04-14 09:54:33 +0200
committerJunio C Hamano <gitster@pobox.com>2012-04-15 14:25:19 -0700
commitbb0dab5d617219d7efe8815cadef6d98c4bc3df8 (patch)
tree41472887fbae6fea7373ae94380e9ed3115dd233 /sha1_name.c
parent9884e67f9d9b511592b981572cfbb30cc50aec61 (diff)
downloadgit-bb0dab5d617219d7efe8815cadef6d98c4bc3df8.tar.gz
Provide better message for barnhc_wiht_tpyo@{u}
Instead of just saying that no upstream exists for such branch, which is true but not very helpful, check that there's no refs/heads/barnhc_wiht_tpyo and tell it to the user. Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_name.c')
-rw-r--r--sha1_name.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sha1_name.c b/sha1_name.c
index c2fe1aae52..e2d576ad7b 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -862,8 +862,11 @@ int interpret_branch_name(const char *name, struct strbuf *buf)
*/
if (!upstream)
return error("HEAD does not point to a branch");
- if (!upstream->merge || !upstream->merge[0]->dst)
+ if (!upstream->merge || !upstream->merge[0]->dst) {
+ if (!ref_exists(upstream->refname))
+ return error("No such branch: '%s'", cp);
return error("No upstream branch found for '%s'", upstream->name);
+ }
free(cp);
cp = shorten_unambiguous_ref(upstream->merge[0]->dst, 0);
strbuf_reset(buf);