summaryrefslogtreecommitdiff
path: root/t/t3701-add-interactive.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-07-30 13:20:32 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-07-30 13:20:32 -0700
commite163cff400ee2d68f17db8e9f344492f445d8e2d (patch)
tree59a36c6e075da16b32c08a6f65ac1a26a90194fe /t/t3701-add-interactive.sh
parentMerge branch 'jk/reject-newer-extensions-in-v0' into master (diff)
parenttest-lib-functions: restrict test_must_fail usage (diff)
downloadtgif-e163cff400ee2d68f17db8e9f344492f445d8e2d.tar.xz
Merge branch 'dl/test-must-fail-fixes-6' into master
Dev support to limit the use of test_must_fail to only git commands. * dl/test-must-fail-fixes-6: test-lib-functions: restrict test_must_fail usage t9400: don't use test_must_fail with cvs t9834: remove use of `test_might_fail p4` t7107: don't use test_must_fail() t5324: reorder `run_with_limited_open_files test_might_fail` t3701: stop using `env` in force_color()
Diffstat (limited to 't/t3701-add-interactive.sh')
-rwxr-xr-xt/t3701-add-interactive.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index 49decbac71..fb73a847cb 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -31,7 +31,16 @@ diff_cmp () {
# indicates a dumb terminal, so we set that variable, too.
force_color () {
- env GIT_PAGER_IN_USE=true TERM=vt100 "$@"
+ # The first element of $@ may be a shell function, as a result POSIX
+ # does not guarantee that "one-shot assignment" will not persist after
+ # the function call. Thus, we prevent these variables from escaping
+ # this function's context with this subshell.
+ (
+ GIT_PAGER_IN_USE=true &&
+ TERM=vt100 &&
+ export GIT_PAGER_IN_USE TERM &&
+ "$@"
+ )
}
test_expect_success 'setup (initial)' '
@@ -604,7 +613,7 @@ test_expect_success 'detect bogus diffFilter output' '
echo content >test &&
test_config interactive.diffFilter "sed 1d" &&
printf y >y &&
- test_must_fail force_color git add -p <y
+ force_color test_must_fail git add -p <y
'
test_expect_success 'diff.algorithm is passed to `git diff-files`' '