Skip to content

Commit d9c7f69

Browse files
avargitster
authored andcommitted
submodule--helper: have --require-init imply --init
Adjust code added in 0060fd1 (clone --recurse-submodules: prevent name squatting on Windows, 2019-09-12) to have the internal --require-init option imply --init, rather than having "git-submodule.sh" add it implicitly. This change doesn't make any difference now, but eliminates another special-case where "git submodule--helper update"'s behavior was different from "git submodule update". This will make it easier to eventually replace the cmd_update() function in git-submodule.sh. We'll still need to keep the distinction between "--init" and "--require-init" in git-submodule.sh. Once cmd_update() gets re-implemented in C we'll be able to change variables and other code related to that, but not yet. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent da3aae9 commit d9c7f69

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

builtin/submodule--helper.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2618,7 +2618,7 @@ static int module_update(int argc, const char **argv, const char *prefix)
26182618
OPT_BOOL(0, "progress", &opt.progress,
26192619
N_("force cloning progress")),
26202620
OPT_BOOL(0, "require-init", &opt.require_init,
2621-
N_("disallow cloning into non-empty directory")),
2621+
N_("disallow cloning into non-empty directory, implies --init")),
26222622
OPT_BOOL(0, "single-branch", &opt.single_branch,
26232623
N_("clone only one branch, HEAD or --branch")),
26242624
OPT_PARSE_LIST_OBJECTS_FILTER(&filter_options),
@@ -2642,6 +2642,9 @@ static int module_update(int argc, const char **argv, const char *prefix)
26422642
argc = parse_options(argc, argv, prefix, module_update_options,
26432643
git_submodule_helper_usage, 0);
26442644

2645+
if (opt.require_init)
2646+
opt.init = 1;
2647+
26452648
if (filter_options.choice && !opt.init) {
26462649
usage_with_options(git_submodule_helper_usage,
26472650
module_update_options);

git-submodule.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ cmd_update()
251251
init=1
252252
;;
253253
--require-init)
254-
init=1
255254
require_init=1
256255
;;
257256
--remote)

0 commit comments

Comments
 (0)