Fail properly when cloning from invalid HTTP URL
Currently, when cloning from invalid HTTP URL, git clone will possibly return curl error, then a confusing message about remote HEAD and then return success and leave an empty repository behind, confusing either the end-user or the automated service calling it (think repo.or.cz). This patch changes the error() calls in get_refs_via_curl() to die()s, akin to the other get_refs_*() functions. Cc: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Petr Baudis committed
Aug 7, 2008 at 02:06 UTC
fd35e42683113e367eee0bb8ac956dde3d95edde
1 file changed
+5
-8
transport.c
+5
-8
@@ -463,17 +463,14 @@ static struct ref *get_refs_via_curl(struct transport *transport)
463
run_active_slot(slot);
464
if (results.curl_result != CURLE_OK) {
465
strbuf_release(&buffer);
466
- if (missing_target(&results)) {
467
- return NULL;
468
- } else {
469
- error("%s", curl_errorstr);
470
- return NULL;
471
- }
466
+ if (missing_target(&results))
467
+ die("%s not found: did you run git update-server-info on the server?", refs_url);
468
+ else
469
+ die("%s download error - %s", refs_url, curl_errorstr);
470
}
471
} else {
472
strbuf_release(&buffer);
475
- error("Unable to start request");
476
- return NULL;
473
+ die("Unable to start HTTP request");
474
}
475
476
data = buffer.buf;