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

Re: [PATCH] http-push: more explicit error message with bad URL or password

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 20, 2008, 23:00 UTC
Message-ID
<7v63xo6r15.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1200756171-11696-3-git-send-email-gb@gbarbier.org>
Grégoire Barbier <gb@gbarbier.org> writes:
> Previously, when URL or password where not set correctly (or
> when some network errors occur), the error message was "no DAV
> locking support".
The standard "Sign-off?" comment aside,...

I think something like this would be much less invasive and more to the point.

-- >8 -- http-push: clarify the reason of error from the initial PROPFIND request

The first thing http-push does is a PROPFIND to see if the other end supports locking. The failure message we give is always reported as "no DAV locking support at the remote repository", regardless of the reason why we ended up not finding the locking support on the other end.

This moves the code to report "no DAV locking support" down the codepath so that the message is issued only when we successfully get a response to PROPFIND and the other end say it does not support locking. Other failures, such as connectivity glitches and credential mismatches, have their own error message issued and we will not issue "no DAV locking" error (we do not even know if the remote end supports it).

---
 http-push.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/http-push.c b/http-push.c
index eef7674..9f92cc1 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1563,9 +1563,17 @@ static int locking_available(void)
 				lock_flags = 0;
 			}
 			XML_ParserFree(parser);
+			if (!lock_flags)
+				error("Error: no DAV locking support on %s",
+				      remote->url);
+
+		} else {
+			error("Cannot access URL %s, return code %d",
+			      remote->url, results.curl_result);
+			lock_flags = 0;
 		}
 	} else {
-		fprintf(stderr, "Unable to start PROPFIND request\n");
+		error("Unable to start PROPFIND request on %s", remote->url);
 	}
 
 	strbuf_release(&out_buffer.buf);
@@ -2230,7 +2238,6 @@ int main(int argc, char **argv)
 
 	/* Verify DAV compliance/lock support */
 	if (!locking_available()) {
-		fprintf(stderr, "Error: no DAV locking support on remote repo %s\n", remote->url);
 		rc = 1;
 		goto cleanup;
 	}
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 12 of 13 in “http-push: fix webdav lock leak.”
  1. http-push: fix webdav lock leak.Grégoire Barbier, Jan 19, 2008
  2. http-push: fail when info/refs exists and is already lockedGrégoire Barbier, Jan 19, 2008
  3. http-push: more explicit error message with bad URL or passwordGrégoire Barbier, Jan 19, 2008
  4. http-push and http-fetch: handle URLs without leading /Grégoire Barbier, Jan 19, 2008
  5. added #define DEFAULT_MAX_REQUESTS for USE_CURL_MULTI modeGrégoire Barbier, Jan 19, 2008
  6. Junio C HamanoJan 21, 2008
  7. Grégoire BarbierJan 21, 2008
  8. Junio C HamanoJan 21, 2008
  9. Mike HommeyJan 19, 2008
  10. Johannes SchindelinJan 19, 2008
  11. Johannes SchindelinJan 19, 2008
  12. Junio C HamanoJan 20, 2008
  13. Johannes SchindelinJan 19, 2008

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.