summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2026-04-21 09:34:21 +0200
committerJunio C Hamano <gitster@pobox.com>2026-04-22 15:53:36 -0700
commitb94900a0cf20e213038102a4cbf072dec5b1bb18 (patch)
tree2ec2125fcd8a2fe52fd18bb9d81f50b847595a84
parentc1e29bcfa88fb8997379c3c7c888961b728e581d (diff)
downloadgit-b94900a0cf20e213038102a4cbf072dec5b1bb18.tar.gz
git-b94900a0cf20e213038102a4cbf072dec5b1bb18.zip
t0008: silence error in subshell when using `grep -v`
In t0008 we use `grep -v` in a subshell, but expect that this command will sometimes not match anything. This would cause grep(1) to return an error code, but given that we don't run with `set -e` we swallow this error. We're about to enable `set -e`. Prepare for this by ignoring any errors. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/t0008-ignores.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh
index e716b5cdfa..d77a179bdd 100755
--- a/t/t0008-ignores.sh
+++ b/t/t0008-ignores.sh
@@ -122,8 +122,8 @@ test_expect_success_multiple () {
fi
testname="$1" expect_all="$2" code="$3"
- expect_verbose=$( echo "$expect_all" | grep -v '^:: ' )
- expect=$( echo "$expect_verbose" | sed -e 's/.* //' )
+ expect_verbose=$(echo "$expect_all" | grep -v '^:: ' || :)
+ expect=$(echo "$expect_verbose" | sed -e 's/.* //')
test_expect_success $prereq "$testname${no_index_opt:+ with $no_index_opt}" '
expect "$expect" &&