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

[PATCH] clone: make sure we support the transport type

From
Jeff King <peff@peff.net>
Date
May 27, 2008, 14:28 UTC
Message-ID
<20080527142842.GA7651@sigill.intra.peff.net>
In-Reply-To
<200805271124.50172.trast@student.ethz.ch>

If we use an unsupported transport (e.g., http when curl support is not compiled in), transport_get reports an error to the user, but we still get a transport object. We need to manually check and abort the clone process at that point, or we end up with a segfault.

Noticed by Thomas Rast.
Signed-off-by: Jeff King <peff@peff.net>
---
There are a few other calls to transport_get in builtin-clone, for
setting up references and doing local cloning. I didn't check, but
assumed it was impossible for http:// remotes to make it to that code
path.
 builtin-clone.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/builtin-clone.c b/builtin-clone.c
index 4740b13..f4accbe 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -449,6 +449,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 		struct remote *remote = remote_get(argv[0]);
 		struct transport *transport = transport_get(remote, argv[0]);
 
+		if (!transport->get_refs_list || !transport->fetch)
+			die("Don't know how to clone %s", transport->url);
+
 		transport_set_option(transport, TRANS_OPT_KEEP, "yes");
 
 		if (option_depth)
-- 
1.5.6.rc0.128.g5fd3b9.dirty
Previous: Thomas RastNext: Mike Hommey
Message 2 of 5 in “Segfault when cloning http:// without libcurl”
  1. Thomas RastMay 27, 2008
  2. clone: make sure we support the transport typeJeff King, May 27, 2008
  3. Mike HommeyMay 27, 2008
  4. Daniel BarkalowMay 27, 2008
  5. Daniel BarkalowMay 27, 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.