diff mbox series

[v2,13/15] apply tests: don't ignore "git ls-files" exit code, drop sub-shell

Message ID patch-v2-13.15-dbe8d168401-20220307T124817Z-avarab@gmail.com (mailing list archive)
State Accepted
Commit e19b3199506a47098d1ca7b21a5e37cabb70f7f2
Headers show
Series tests: don't ignore "git" exit codes | expand

Commit Message

Ævar Arnfjörð Bjarmason March 7, 2022, 12:49 p.m. UTC
Fix code added in 969c877506c (git apply --directory broken for new
files, 2008-10-12) so that it doesn't invoke "git ls-files" on the
left-hand-side of a pipe, instead let's use an intermediate file.

Since we're doing that we can also drop the sub-shell that was here to
group the two.

There are a lot of these sorts of patterns in the test suite, and
there's no particular reason to fix this one other than in a preceding
commit all similar patterns except this one were fixed in
"t/t4128-apply-root.sh", so let's fix this one straggler as well.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t4128-apply-root.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/t/t4128-apply-root.sh b/t/t4128-apply-root.sh
index ba89a2f2d73..f6db5a79dd9 100755
--- a/t/t4128-apply-root.sh
+++ b/t/t4128-apply-root.sh
@@ -96,7 +96,8 @@  test_expect_success 'apply --directory (delete file)' '
 	echo content >some/sub/dir/delfile &&
 	git add some/sub/dir/delfile &&
 	git apply --directory=some/sub/dir/ --index patch &&
-	! (git ls-files | grep delfile)
+	git ls-files >out &&
+	! grep delfile out
 '
 
 cat > patch << 'EOF'