git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Silence confusing and false-positive curl error message

From
Petr Baudis <pasky@suse.cz>
Date
Oct 21, 2005, 16:18 UTC
Message-ID
<20051021161846.18478.50202.stgit@machine.or.cz>

git-http-fetch spits out curl 404 error message when unable to fetch an object, but that's confusing since no error really happenned 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>
---
 http-fetch.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/http-fetch.c b/http-fetch.c
index a7dc2cc..2d76ee1 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -1069,9 +1069,12 @@ static int fetch_object(struct alt_base 
 	}
 
 	if (request->curl_result != CURLE_OK && request->http_code != 416) {
-		ret = error("%s (curl_result = %d, http_code = %ld, sha1 = %s)",
-			    request->errorstr, request->curl_result,
-			    request->http_code, hex);
+		if (request->http_code == 404)
+			ret = -1; /* Be silent, it is probably in a pack. */
+		else
+			ret = error("%s (curl_result = %d, http_code = %ld, sha1 = %s)",
+				    request->errorstr, request->curl_result,
+				    request->http_code, hex);
 		release_request(request);
 		return ret;
 	}
Message 1 of 1 in “Silence confusing and false-positive curl error message”
  1. Silence confusing and false-positive curl error messagePetr Baudis, Oct 21, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.