blob: 6232218e8c6ae2e8d5bc8c2d4a8d7e4dc521e079 [file] [log] [blame]
From 56b40fee797d4eb887a71e2fdb443773398a33bf Mon Sep 17 00:00:00 2001
From: Jeff King <peff@peff.net>
Date: Mon, 24 Sep 2018 04:32:15 -0400
Subject: submodule--helper: use "--" to signal end of clone options
commit 98afac7a7cefdca0d2c4917dd8066a59f7088265 upstream.
When we clone a submodule, we call "git clone $url $path".
But there's nothing to say that those components can't begin
with a dash themselves, confusing git-clone into thinking
they're options. Let's pass "--" to make it clear what we
expect.
There's no test here, because it's actually quite hard to
make these names work, even with "git clone" parsing them
correctly. And we're going to restrict these cases even
further in future commits. So we'll leave off testing until
then; this is just the minimal fix to prevent us from doing
something stupid with a badly formed entry.
Reported-by: joernchen <joernchen@phenoelit.de>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
builtin/submodule--helper.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 25555393f1..b6801b6c7a 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -469,6 +469,7 @@ static int clone_submodule(const char *path, const char *gitdir, const char *url
if (gitdir && *gitdir)
argv_array_pushl(&cp.args, "--separate-git-dir", gitdir, NULL);
+ argv_array_push(&cp.args, "--");
argv_array_push(&cp.args, url);
argv_array_push(&cp.args, path);
--
2.19.0.605.g01d371f741