* [PATCH] Fail properly when cloning from invalid HTTP URL
@ 2008-08-07 0:06 pasky
2008-08-07 0:24 ` Junio C Hamano
2008-08-07 14:10 ` Daniel Barkalow
0 siblings, 2 replies; 3+ messages in thread
From: pasky @ 2008-08-07 0:06 UTC (permalink / raw)
To: gitster; +Cc: git, barkalow, Petr Baudis
From: Petr Baudis <pasky@suse.cz>
Currently, when cloning from invalid HTTP URL, git clone will possibly
return curl error, then a confusing message about remote HEAD and then
return success and leave an empty repository behind, confusing either
the end-user or the automated service calling it (think repo.or.cz).
This patch changes the error() calls in get_refs_via_curl() to die()s,
akin to the other get_refs_*() functions.
Cc: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Petr Baudis <pasky@suse.cz>
---
transport.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/transport.c b/transport.c
index 6eb65b8..b88b89b 100644
--- a/transport.c
+++ b/transport.c
@@ -464,16 +464,15 @@ static struct ref *get_refs_via_curl(struct transport *transport)
if (results.curl_result != CURLE_OK) {
strbuf_release(&buffer);
if (missing_target(&results)) {
+ die("%s not found: did you run git update-server-info on the server?", refs_url);
return NULL;
} else {
- error("%s", curl_errorstr);
- return NULL;
+ die("%s download error - %s", refs_url, curl_errorstr);
}
}
} else {
strbuf_release(&buffer);
- error("Unable to start request");
- return NULL;
+ die("Unable to start HTTP request");
}
data = buffer.buf;
--
1.5.6.3.392.g292f1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Fail properly when cloning from invalid HTTP URL
2008-08-07 0:06 [PATCH] Fail properly when cloning from invalid HTTP URL pasky
@ 2008-08-07 0:24 ` Junio C Hamano
2008-08-07 14:10 ` Daniel Barkalow
1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2008-08-07 0:24 UTC (permalink / raw)
To: pasky; +Cc: git, barkalow
pasky@suse.cz writes:
> diff --git a/transport.c b/transport.c
> index 6eb65b8..b88b89b 100644
> --- a/transport.c
> +++ b/transport.c
> @@ -464,16 +464,15 @@ static struct ref *get_refs_via_curl(struct transport *transport)
> if (results.curl_result != CURLE_OK) {
> strbuf_release(&buffer);
> if (missing_target(&results)) {
> + die("%s not found: did you run git update-server-info on the server?", refs_url);
> return NULL;
Hmm, I do not see a deletion of a line here...
Everybody else in the get_refs_via_ family just die()s, and the caller of
them do not notice nor treat NULL as anything special; I think your patch
is a sensible thing to do.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fail properly when cloning from invalid HTTP URL
2008-08-07 0:06 [PATCH] Fail properly when cloning from invalid HTTP URL pasky
2008-08-07 0:24 ` Junio C Hamano
@ 2008-08-07 14:10 ` Daniel Barkalow
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Barkalow @ 2008-08-07 14:10 UTC (permalink / raw)
To: Petr Baudis; +Cc: gitster, git
On Thu, 7 Aug 2008, pasky@suse.cz wrote:
> From: Petr Baudis <pasky@suse.cz>
>
> Currently, when cloning from invalid HTTP URL, git clone will possibly
> return curl error, then a confusing message about remote HEAD and then
> return success and leave an empty repository behind, confusing either
> the end-user or the automated service calling it (think repo.or.cz).
>
> This patch changes the error() calls in get_refs_via_curl() to die()s,
> akin to the other get_refs_*() functions.
>
> Cc: Daniel Barkalow <barkalow@iabervon.org>
> Signed-off-by: Petr Baudis <pasky@suse.cz>
> ---
> transport.c | 7 +++----
> 1 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/transport.c b/transport.c
> index 6eb65b8..b88b89b 100644
> --- a/transport.c
> +++ b/transport.c
> @@ -464,16 +464,15 @@ static struct ref *get_refs_via_curl(struct transport *transport)
> if (results.curl_result != CURLE_OK) {
> strbuf_release(&buffer);
> if (missing_target(&results)) {
> + die("%s not found: did you run git update-server-info on the server?", refs_url);
> return NULL;
The "return NULL" isn't necessary any more. Otherwise,
Acked-by: Daniel Barkalow <barkalow@iabervon.org>
> } else {
> - error("%s", curl_errorstr);
> - return NULL;
> + die("%s download error - %s", refs_url, curl_errorstr);
> }
> }
> } else {
> strbuf_release(&buffer);
> - error("Unable to start request");
> - return NULL;
> + die("Unable to start HTTP request");
> }
>
> data = buffer.buf;
> --
> 1.5.6.3.392.g292f1
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-08-07 14:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-07 0:06 [PATCH] Fail properly when cloning from invalid HTTP URL pasky
2008-08-07 0:24 ` Junio C Hamano
2008-08-07 14:10 ` Daniel Barkalow
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).