remote.c: report specific errors from branch_get_upstream

When the previous commit introduced the branch_get_upstream
helper, there was one call-site that could not be converted:
the one in sha1_name.c, which gives detailed error messages
for each possible failure.

Let's teach the helper to optionally report these specific
errors. This lets us convert another callsite, and means we
can use the helper in other locations that want to give the
same error messages.

The logic and error messages come straight from sha1_name.c,
with the exception that we start each error with a lowercase
letter, as is our usual style (note that a few tests need
updated as a result).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King
2015-05-21 00:45:32 -04:00
committed by Junio C Hamano
parent a9f9f8cc1f
commit 3a429d0af3
7 changed files with 48 additions and 30 deletions

View File

@ -123,7 +123,7 @@ static int branch_merged(int kind, const char *name,
if (kind == REF_LOCAL_BRANCH) {
struct branch *branch = branch_get(name);
const char *upstream = branch_get_upstream(branch);
const char *upstream = branch_get_upstream(branch, NULL);
unsigned char sha1[20];
if (upstream &&