Re: [PATCH v2 5/6] t: convert grep assertions to test_grep
From: Junio C Hamano <hidden>
Date: 2026-06-27 14:36:10
SZEDER Gábor [off-list ref] writes:
quoted
The conversion was generated using a grep-assertion linter (greplint.pl, added in the following commit) to identify bare grep calls at command position. To reproduce: # Step 1: mark bare greps that should not be converted sed -i '/! grep "$m" \.git\/packed-refs/s/$/ # lint-ok: file may not exist (reftable)/' \ t/t1400-update-ref.sh sed -i '/! grep dirty file3 &&/{/lint-ok/!s/$/ # lint-ok: file may not exist after --quit/}' \ t/t3420-rebase-autostash.shI think in this case checking the file3's contents is wrong, because at this point file3 should not exist in the first place. I've sent a patch to fix this long ago, but apparently didn't manage to follow through back then. https://lore.kernel.org/git/20211010172809.1472914-1-szeder.dev@gmail.com/ (local)
Thanks. I guess the test_grep can be extended to catch this case,
where
test_grep ! -e pattern1 -e pattern2 file
does not find any hits, but only because 'file' is missing, as an
error, just like "test_must_fail git foo" that segfaults is flagged
as "yes, it fails but that is not the kind of failure we expect".