Skip to content

Commit 0f755c7

Browse files
pks-tgitster
authored andcommitted
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>
1 parent 1b66844 commit 0f755c7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

t/t0008-ignores.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ test_expect_success_multiple () {
122122
fi
123123
testname="$1" expect_all="$2" code="$3"
124124

125-
expect_verbose=$( echo "$expect_all" | grep -v '^:: ' )
126-
expect=$( echo "$expect_verbose" | sed -e 's/.* //' )
125+
expect_verbose=$(echo "$expect_all" | grep -v '^:: ' || true)
126+
expect=$(echo "$expect_verbose" | sed -e 's/.* //')
127127

128128
test_expect_success $prereq "$testname${no_index_opt:+ with $no_index_opt}" '
129129
expect "$expect" &&

0 commit comments

Comments
 (0)