Skip to content

Commit 37b78c2

Browse files
peffgitster
authored andcommitted
clone: make sure we support the transport type
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> Acked-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent cb418b5 commit 37b78c2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

builtin-clone.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
449449
struct remote *remote = remote_get(argv[0]);
450450
struct transport *transport = transport_get(remote, argv[0]);
451451

452+
if (!transport->get_refs_list || !transport->fetch)
453+
die("Don't know how to clone %s", transport->url);
454+
452455
transport_set_option(transport, TRANS_OPT_KEEP, "yes");
453456

454457
if (option_depth)

0 commit comments

Comments
 (0)