Skip to content

Commit f5c7cd9

Browse files
mikecrowegitster
authored andcommitted
push: test that --recurse-submodules on command line overrides config
t5531 only checked that the push.recurseSubmodules config option was overridden by passing --recurse-submodules=check on the command line. Add new tests for overriding with --recurse-submodules=no, --no-recurse-submodules and --recurse-submodules=push too. Also correct minor typo in test commit message. Signed-off-by: Mike Crowe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b33a15b commit f5c7cd9

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

t/t5531-deep-submodule-push.sh

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,24 +126,48 @@ test_expect_success 'push succeeds if submodule commit not on remote but using o
126126
)
127127
'
128128

129-
test_expect_success 'push fails if submodule commit not on remote using check from cmdline overriding config' '
129+
test_expect_success 'push recurse-submodules on command line overrides config' '
130130
(
131131
cd work/gar/bage &&
132132
>recurse-check-on-command-line-overriding-config &&
133133
git add recurse-check-on-command-line-overriding-config &&
134-
git commit -m "Recurse on command-line overridiing config junk"
134+
git commit -m "Recurse on command-line overriding config junk"
135135
) &&
136136
(
137137
cd work &&
138138
git add gar/bage &&
139139
git commit -m "Recurse on command-line overriding config for gar/bage" &&
140+
141+
# Ensure that we can override on-demand in the config
142+
# to just check submodules
140143
test_must_fail git -c push.recurseSubmodules=on-demand push --recurse-submodules=check ../pub.git master &&
141144
# Check that the supermodule commit did not get there
142145
git fetch ../pub.git &&
143146
git diff --quiet FETCH_HEAD master^ &&
144147
# Check that the submodule commit did not get there
145-
cd gar/bage &&
146-
git diff --quiet origin/master master^
148+
(cd gar/bage && git diff --quiet origin/master master^) &&
149+
150+
# Ensure that we can override check in the config to
151+
# disable submodule recursion entirely
152+
(cd gar/bage && git diff --quiet origin/master master^) &&
153+
git -c push.recurseSubmodules=on-demand push --recurse-submodules=no ../pub.git master &&
154+
git fetch ../pub.git &&
155+
git diff --quiet FETCH_HEAD master &&
156+
(cd gar/bage && git diff --quiet origin/master master^) &&
157+
158+
# Ensure that we can override check in the config to
159+
# disable submodule recursion entirely (alternative form)
160+
git -c push.recurseSubmodules=on-demand push --no-recurse-submodules ../pub.git master &&
161+
git fetch ../pub.git &&
162+
git diff --quiet FETCH_HEAD master &&
163+
(cd gar/bage && git diff --quiet origin/master master^) &&
164+
165+
# Ensure that we can override check in the config to
166+
# push the submodule too
167+
git -c push.recurseSubmodules=check push --recurse-submodules=on-demand ../pub.git master &&
168+
git fetch ../pub.git &&
169+
git diff --quiet FETCH_HEAD master &&
170+
(cd gar/bage && git diff --quiet origin/master master)
147171
)
148172
'
149173

0 commit comments

Comments
 (0)