diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2022-06-28 13:05:27 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-06-28 23:13:17 +0300 |
commit | d9c7f69aaa6b001949e9d2b693c22c595cc9d0d6 (patch) | |
tree | 7991e7bc59efb9f8e87a9c093813852d0ad2f289 | |
parent | da3aae9e8476af3b23363d39dba86b679c14a498 (diff) |
submodule--helper: have --require-init imply --init
Adjust code added in 0060fd1511b (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 <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | builtin/submodule--helper.c | 5 | ||||
-rwxr-xr-x | git-submodule.sh | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 5c77dfcffe..f0702d0cfa 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -2618,7 +2618,7 @@ static int module_update(int argc, const char **argv, const char *prefix) OPT_BOOL(0, "progress", &opt.progress, N_("force cloning progress")), OPT_BOOL(0, "require-init", &opt.require_init, - N_("disallow cloning into non-empty directory")), + N_("disallow cloning into non-empty directory, implies --init")), OPT_BOOL(0, "single-branch", &opt.single_branch, N_("clone only one branch, HEAD or --branch")), OPT_PARSE_LIST_OBJECTS_FILTER(&filter_options), @@ -2642,6 +2642,9 @@ static int module_update(int argc, const char **argv, const char *prefix) argc = parse_options(argc, argv, prefix, module_update_options, git_submodule_helper_usage, 0); + if (opt.require_init) + opt.init = 1; + if (filter_options.choice && !opt.init) { usage_with_options(git_submodule_helper_usage, module_update_options); diff --git a/git-submodule.sh b/git-submodule.sh index 20fc1b620f..5b9683bf76 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -251,7 +251,6 @@ cmd_update() init=1 ;; --require-init) - init=1 require_init=1 ;; --remote) |