Skip to content

Commit dcf0d12

Browse files
committed
Merge branch 'rt/commit-cleanup-config'
Fix tests that contaminated their environments and affected new tests introduced later in the sequence by containing their effects in their own subshells. * rt/commit-cleanup-config: t7502: perform commits using alternate editor in a subshell
2 parents 42e129f + 24e099f commit dcf0d12

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

t/t7502-commit.sh

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -263,32 +263,40 @@ test_expect_success 'cleanup commit message (fail on invalid cleanup mode config
263263
test_expect_success 'cleanup commit message (no config and no option uses default)' '
264264
echo content >>file &&
265265
git add file &&
266-
test_set_editor "$TEST_DIRECTORY"/t7500/add-content-and-comment &&
267-
git commit --no-status &&
266+
(
267+
test_set_editor "$TEST_DIRECTORY"/t7500/add-content-and-comment &&
268+
git commit --no-status
269+
) &&
268270
commit_msg_is "commit message"
269271
'
270272

271273
test_expect_success 'cleanup commit message (option overrides default)' '
272274
echo content >>file &&
273275
git add file &&
274-
test_set_editor "$TEST_DIRECTORY"/t7500/add-content-and-comment &&
275-
git commit --cleanup=whitespace --no-status &&
276+
(
277+
test_set_editor "$TEST_DIRECTORY"/t7500/add-content-and-comment &&
278+
git commit --cleanup=whitespace --no-status
279+
) &&
276280
commit_msg_is "commit message # comment"
277281
'
278282

279283
test_expect_success 'cleanup commit message (config overrides default)' '
280284
echo content >>file &&
281285
git add file &&
282-
test_set_editor "$TEST_DIRECTORY"/t7500/add-content-and-comment &&
283-
git -c commit.cleanup=whitespace commit --no-status &&
286+
(
287+
test_set_editor "$TEST_DIRECTORY"/t7500/add-content-and-comment &&
288+
git -c commit.cleanup=whitespace commit --no-status
289+
) &&
284290
commit_msg_is "commit message # comment"
285291
'
286292

287293
test_expect_success 'cleanup commit message (option overrides config)' '
288294
echo content >>file &&
289295
git add file &&
290-
test_set_editor "$TEST_DIRECTORY"/t7500/add-content-and-comment &&
291-
git -c commit.cleanup=whitespace commit --cleanup=default &&
296+
(
297+
test_set_editor "$TEST_DIRECTORY"/t7500/add-content-and-comment &&
298+
git -c commit.cleanup=whitespace commit --cleanup=default
299+
) &&
292300
commit_msg_is "commit message"
293301
'
294302

0 commit comments

Comments
 (0)