Skip to content

Commit

Permalink
Fail properly when cloning from invalid HTTP URL
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Petr Baudis authored and Junio C Hamano committed Aug 7, 2008
1 parent 781c183 commit fd35e42
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,17 +463,14 @@ static struct ref *get_refs_via_curl(struct transport *transport)
run_active_slot(slot);
if (results.curl_result != CURLE_OK) {
strbuf_release(&buffer);
if (missing_target(&results)) {
return NULL;
} else {
error("%s", curl_errorstr);
return NULL;
}
if (missing_target(&results))
die("%s not found: did you run git update-server-info on the server?", refs_url);
else
die("%s download error - %s", refs_url, curl_errorstr);
}
} else {
strbuf_release(&buffer);
error("Unable to start request");
return NULL;
die("Unable to start HTTP request");
}

data = buffer.buf;
Expand Down

0 comments on commit fd35e42

Please sign in to comment.