{"thread":{"id":"2183","subject":"[PATCH] Silence confusing and false-positive curl error message","startedAt":"2005-10-21T16:18:46Z","lastAt":"2005-10-21T16:18:46Z","messageCount":1,"participants":["Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"10430","messageId":"20051021161846.18478.50202.stgit@machine.or.cz","threadId":"2183","inReplyTo":null,"subject":"[PATCH] Silence confusing and false-positive curl error message","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2005-10-21T16:18:46Z","receivedAt":"2005-10-21T16:18:46Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"git-http-fetch spits out curl 404 error message when unable to fetch an object,\nbut that's confusing since no error really happenned and the object is usually\nfound in a pack it tries right after that. And if the object still cannot be\nretrieved, it will say another error message anyway. OTOH other HTTP errors\n(403 etc) are likely fatal and the user should be still informed about them.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n---\n\n http-fetch.c |    9 ++++++---\n 1 files changed, 6 insertions(+), 3 deletions(-)\n\ndiff --git a/http-fetch.c b/http-fetch.c\nindex a7dc2cc..2d76ee1 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -1069,9 +1069,12 @@ static int fetch_object(struct alt_base \n \t}\n \n \tif (request->curl_result != CURLE_OK && request->http_code != 416) {\n-\t\tret = error(\"%s (curl_result = %d, http_code = %ld, sha1 = %s)\",\n-\t\t\t    request->errorstr, request->curl_result,\n-\t\t\t    request->http_code, hex);\n+\t\tif (request->http_code == 404)\n+\t\t\tret = -1; /* Be silent, it is probably in a pack. */\n+\t\telse\n+\t\t\tret = error(\"%s (curl_result = %d, http_code = %ld, sha1 = %s)\",\n+\t\t\t\t    request->errorstr, request->curl_result,\n+\t\t\t\t    request->http_code, hex);\n \t\trelease_request(request);\n \t\treturn ret;\n \t}\n"}]}