t7508: fix bogus mtime verification

The current `grep`-approach in "--no-optional-locks prevents index update" may fail e.g. for `out` file contents "1234567890999" [1]. Fix this by using test-lib's new mtime-verification API. [1] https://lore.kernel.org/git/xmqqczl5hpaq.fsf@gitster.g/T/#u Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Marc Strapetz committed Jan 7, 2022 at 11:17 UTC 0275e4daabed330c4d27cc9a482c2d23d7544aca
1 file changed +3 -5
t/t7508-status.sh
+3 -5
@@ -1647,13 +1647,11 @@ test_expect_success '"Initial commit" should not be noted in commit template' '
1647 '
1648
1649 test_expect_success '--no-optional-locks prevents index update' '
1650 - test-tool chmtime =1234567890 .git/index &&
1650 + test_set_magic_mtime .git/index &&
1651 git --no-optional-locks status &&
1652 - test-tool chmtime --get .git/index >out &&
1653 - grep ^1234567890 out &&
1652 + test_is_magic_mtime .git/index &&
1653 git status &&
1655 - test-tool chmtime --get .git/index >out &&
1656 - ! grep ^1234567890 out
1654 + ! test_is_magic_mtime .git/index
1655 '
1656
1657 test_done