Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenton Liu <liu.denton@gmail.com>2020-01-07 07:53:13 +0300
committerJunio C Hamano <gitster@pobox.com>2020-01-27 23:56:02 +0300
commit37a63faae58aee5cd2dd9806d2e98c9ad998a7e5 (patch)
tree35946abb75fd55bdb053061d671d971643377215 /t/t4124-apply-ws-rule.sh
parenta8c663cf65ae1e40c90bfd4a1dd3e8d1826eafbe (diff)
t4124: only mark git command with test_must_fail
The test_must_fail function should only be used for git commands since we should assume that external commands work sanely. Since apply_patch wraps a sed and git invocation, rewrite it to accept an `!` argument which would cause only the git command to be prefixed with `test_must_fail`. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4124-apply-ws-rule.sh')
-rwxr-xr-xt/t4124-apply-ws-rule.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh
index ff51e9e789..971a5a7512 100755
--- a/t/t4124-apply-ws-rule.sh
+++ b/t/t4124-apply-ws-rule.sh
@@ -35,9 +35,15 @@ prepare_test_file () {
}
apply_patch () {
+ cmd_prefix= &&
+ if test "x$1" = 'x!'
+ then
+ cmd_prefix=test_must_fail &&
+ shift
+ fi &&
>target &&
sed -e "s|\([ab]\)/file|\1/target|" <patch |
- git apply "$@"
+ $cmd_prefix git apply "$@"
}
test_fix () {
@@ -99,7 +105,7 @@ test_expect_success 'whitespace=warn, default rule' '
test_expect_success 'whitespace=error-all, default rule' '
- test_must_fail apply_patch --whitespace=error-all &&
+ apply_patch ! --whitespace=error-all &&
test_must_be_empty target
'