From: Junio C Hamano Date: Sat, 27 Jun 2026 14:36:08 GMT Subject: Re: [PATCH v2 5/6] t: convert grep assertions to test_grep Message-ID: In-Reply-To: SZEDER Gábor writes: >> 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.sh > > I 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/ 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".