Skip to content

Commit de89f0b

Browse files
peffgitster
authored andcommitted
remote-curl: die directly with http error messages
When we encounter an unknown http error (e.g., a 403), we hand the error code to http_error, which then prints it with error(). After that we die with the redundant message "HTTP request failed". Instead, let's just drop http_error entirely, which does nothing but pass arguments to error(), and instead die directly with a useful message. So before: $ git clone https://example.com/repo.git Cloning into 'repo'... error: unable to access 'https://example.com/repo.git': The requested URL returned error: 403 Forbidden fatal: HTTP request failed and after: $ git clone https://example.com/repo.git Cloning into 'repo'... fatal: unable to access 'https://example.com/repo.git': The requested URL returned error: 403 Forbidden Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 39a570f commit de89f0b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

remote-curl.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,7 @@ static struct discovery* discover_refs(const char *service, int for_push)
216216
die("Authentication failed for '%s'", url);
217217
default:
218218
show_http_message(&type, &buffer);
219-
http_error(url);
220-
die("HTTP request failed");
219+
die("unable to access '%s': %s", url, curl_errorstr);
221220
}
222221

223222
last= xcalloc(1, sizeof(*last_discovery));

0 commit comments

Comments
 (0)