Skip to content

Commit 899df5f

Browse files
committed
Merge branch 'gc/submodule-update-part2' into maint
"git submodule update" without pathspec should silently skip an uninitialized submodule, but it started to become noisy by mistake. This fixes a regression in 2.36 and is slate to go to 2.36.1 source: <[email protected]> * gc/submodule-update-part2: submodule--helper: fix initialization of warn_if_uninitialized
2 parents 6cd33dc + 4f1ccef commit 899df5f

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

builtin/submodule--helper.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2026,7 +2026,6 @@ struct update_data {
20262026
.references = STRING_LIST_INIT_DUP, \
20272027
.single_branch = -1, \
20282028
.max_jobs = 1, \
2029-
.warn_if_uninitialized = 1, \
20302029
}
20312030

20322031
static void next_submodule_warn_missing(struct submodule_update_clone *suc,

t/t7406-submodule-update.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,39 @@ test_expect_success 'submodule update --init skips submodule with update=none' '
670670
)
671671
'
672672

673+
test_expect_success 'submodule update with pathspec warns against uninitialized ones' '
674+
test_when_finished "rm -fr selective" &&
675+
git clone super selective &&
676+
(
677+
cd selective &&
678+
git submodule init submodule &&
679+
680+
git submodule update submodule 2>err &&
681+
! grep "Submodule path .* not initialized" err &&
682+
683+
git submodule update rebasing 2>err &&
684+
grep "Submodule path .rebasing. not initialized" err &&
685+
686+
test_path_exists submodule/.git &&
687+
test_path_is_missing rebasing/.git
688+
)
689+
690+
'
691+
692+
test_expect_success 'submodule update without pathspec updates only initialized ones' '
693+
test_when_finished "rm -fr selective" &&
694+
git clone super selective &&
695+
(
696+
cd selective &&
697+
git submodule init submodule &&
698+
git submodule update 2>err &&
699+
test_path_exists submodule/.git &&
700+
test_path_is_missing rebasing/.git &&
701+
! grep "Submodule path .* not initialized" err
702+
)
703+
704+
'
705+
673706
test_expect_success 'submodule update continues after checkout error' '
674707
(cd super &&
675708
git reset --hard HEAD &&

0 commit comments

Comments
 (0)