Silence confusing and false-positive curl error message
git-http-fetch spits out curl 404 error message when unable to fetch an object, but that's confusing since no error really happened and the object is usually found in a pack it tries right after that. And if the object still cannot be retrieved, it will say another error message anyway. OTOH other HTTP errors (403 etc) are likely fatal and the user should be still informed about them. Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>
Petr Baudis committed
Oct 21, 2005 at 18:18 UTC
e2029eb963bab6efeff48a7e1ded93842a257717
1 file changed
+6
-3
http-fetch.c
+6
-3
@@ -1095,9 +1095,12 @@ static int fetch_object(struct alt_base *repo, unsigned char *sha1)
1095
}
1096
1097
if (request->curl_result != CURLE_OK && request->http_code != 416) {
1098
- ret = error("%s (curl_result = %d, http_code = %ld, sha1 = %s)",
1099
- request->errorstr, request->curl_result,
1100
- request->http_code, hex);
1098
+ if (request->http_code == 404)
1099
+ ret = -1; /* Be silent, it is probably in a pack. */
1100
+ else
1101
+ ret = error("%s (curl_result = %d, http_code = %ld, sha1 = %s)",
1102
+ request->errorstr, request->curl_result,
1103
+ request->http_code, hex);
1104
release_request(request);
1105
return ret;
1106
}