提交 a14c2256 编写于 作者: N Nick Hengeveld 提交者: Junio C Hamano

Fix for http-fetch from file:// URLs

Recognize missing files when using http-fetch with file:// URLs
Signed-off-by: NNick Hengeveld <nickh@reactrix.com>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 e99fcf96
...@@ -267,7 +267,8 @@ static void process_object_response(void *callback_data) ...@@ -267,7 +267,8 @@ static void process_object_response(void *callback_data)
obj_req->state = COMPLETE; obj_req->state = COMPLETE;
/* Use alternates if necessary */ /* Use alternates if necessary */
if (obj_req->http_code == 404) { if (obj_req->http_code == 404 ||
obj_req->curl_result == CURLE_FILE_COULDNT_READ_FILE) {
fetch_alternates(alt->base); fetch_alternates(alt->base);
if (obj_req->repo->next != NULL) { if (obj_req->repo->next != NULL) {
obj_req->repo = obj_req->repo =
...@@ -475,7 +476,8 @@ static void process_alternates_response(void *callback_data) ...@@ -475,7 +476,8 @@ static void process_alternates_response(void *callback_data)
} }
} }
} else if (slot->curl_result != CURLE_OK) { } else if (slot->curl_result != CURLE_OK) {
if (slot->http_code != 404) { if (slot->http_code != 404 &&
slot->curl_result != CURLE_FILE_COULDNT_READ_FILE) {
got_alternates = -1; got_alternates = -1;
return; return;
} }
...@@ -637,7 +639,8 @@ static int fetch_indices(struct alt_base *repo) ...@@ -637,7 +639,8 @@ static int fetch_indices(struct alt_base *repo)
if (start_active_slot(slot)) { if (start_active_slot(slot)) {
run_active_slot(slot); run_active_slot(slot);
if (slot->curl_result != CURLE_OK) { if (slot->curl_result != CURLE_OK) {
if (slot->http_code == 404) { if (slot->http_code == 404 ||
slot->curl_result == CURLE_FILE_COULDNT_READ_FILE) {
repo->got_indices = 1; repo->got_indices = 1;
free(buffer.buffer); free(buffer.buffer);
return 0; return 0;
...@@ -802,7 +805,8 @@ static int fetch_object(struct alt_base *repo, unsigned char *sha1) ...@@ -802,7 +805,8 @@ static int fetch_object(struct alt_base *repo, unsigned char *sha1)
ret = error("Request for %s aborted", hex); ret = error("Request for %s aborted", hex);
} else if (obj_req->curl_result != CURLE_OK && } else if (obj_req->curl_result != CURLE_OK &&
obj_req->http_code != 416) { obj_req->http_code != 416) {
if (obj_req->http_code == 404) if (obj_req->http_code == 404 ||
obj_req->curl_result == CURLE_FILE_COULDNT_READ_FILE)
ret = -1; /* Be silent, it is probably in a pack. */ ret = -1; /* Be silent, it is probably in a pack. */
else else
ret = error("%s (curl_result = %d, http_code = %ld, sha1 = %s)", ret = error("%s (curl_result = %d, http_code = %ld, sha1 = %s)",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册