Skip to content

Commit

Permalink
t7508: fix bogus mtime verification
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mstrap authored and gitster committed Jan 7, 2022
1 parent ab6245b commit 0275e4d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions t/t7508-status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1647,13 +1647,11 @@ test_expect_success '"Initial commit" should not be noted in commit template' '
'

test_expect_success '--no-optional-locks prevents index update' '
test-tool chmtime =1234567890 .git/index &&
test_set_magic_mtime .git/index &&
git --no-optional-locks status &&
test-tool chmtime --get .git/index >out &&
grep ^1234567890 out &&
test_is_magic_mtime .git/index &&
git status &&
test-tool chmtime --get .git/index >out &&
! grep ^1234567890 out
! test_is_magic_mtime .git/index
'

test_done

0 comments on commit 0275e4d

Please sign in to comment.