Skip to content

Commit 98afac7

Browse files
peffgitster
authored andcommitted
submodule--helper: use "--" to signal end of clone options
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 <[email protected]> Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4dde7b8 commit 98afac7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

builtin/submodule--helper.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,7 @@ static int clone_submodule(const char *path, const char *gitdir, const char *url
510510
if (gitdir && *gitdir)
511511
argv_array_pushl(&cp.args, "--separate-git-dir", gitdir, NULL);
512512

513+
argv_array_push(&cp.args, "--");
513514
argv_array_push(&cp.args, url);
514515
argv_array_push(&cp.args, path);
515516

0 commit comments

Comments
 (0)