From: Denton Liu Date: Fri, 15 Nov 2019 01:01:22 GMT Subject: [PATCH 22/27] t0090: mask failing grep status Message-ID: <0f3d1c04a1283675db0c6704bbdd2566d405163e.1573779465.git.liu.denton@gmail.com> In-Reply-To: In a future patch, we plan on running tests with `set -o pipefail`. However, since grep can return failure in the case that no lines are matched, this can trigger a failure in a pipe in the case where grep is being used as a filter. Use test_grep_return_success() instead of grep so that we don't fail even if we have no matching lines. Signed-off-by: Denton Liu --- t/t0090-cache-tree.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh index 5a633690bf..b0f3b69d1d 100755 --- a/t/t0090-cache-tree.sh +++ b/t/t0090-cache-tree.sh @@ -22,7 +22,7 @@ generate_expected_cache_tree_rec () { # ls-files might have foo/bar, foo/bar/baz, and foo/bar/quux # We want to count only foo because it's the only direct child git ls-files >files && - subtrees=$(grep / files|cut -d / -f 1|uniq) && + subtrees=$(test_grep_return_success / files|cut -d / -f 1|uniq) && subtree_count=$(echo "$subtrees"|awk -v c=0 '$1 != "" {++c} END {print c}') && entries=$(wc -l