Skip to content

Commit aa7c5fe

Browse files
chooglengitster
authored andcommitted
submodule update: pass --require-init and --init
git-submodule.sh::cmd_update() makes "--require-init" imply "--init". Move this logic into "git submodule--helper update" instead, and append both options to `opts`. Signed-off-by: Glen Choo <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e3402c6 commit aa7c5fe

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

builtin/submodule--helper.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2642,6 +2642,10 @@ 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+
}
2648+
26452649
if (filter_options.choice && !opt.init) {
26462650
usage_with_options(git_submodule_helper_usage,
26472651
module_update_options);

git-submodule.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ branch=
3434
force=
3535
cached=
3636
recursive=
37-
init=
38-
require_init=
3937
files=
4038
update=
4139
prefix=
@@ -254,11 +252,10 @@ cmd_update()
254252
opts="$opts $1"
255253
;;
256254
-i|--init)
257-
init=1
255+
opts="$opts $1"
258256
;;
259257
--require-init)
260-
init=1
261-
require_init=1
258+
opts="$opts $1"
262259
;;
263260
--remote)
264261
opts="$opts $1"
@@ -344,11 +341,9 @@ cmd_update()
344341

345342
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper update \
346343
${GIT_QUIET:+--quiet} \
347-
${init:+--init} \
348344
${wt_prefix:+--prefix "$wt_prefix"} \
349345
${prefix:+--recursive-prefix "$prefix"} \
350346
${update:+--update "$update"} \
351-
${require_init:+--require-init} \
352347
$opts \
353348
-- \
354349
"$@"

0 commit comments

Comments
 (0)