]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t7900: fix a flaky test due to git-repack always regenerating MIDX
authorPatrick Steinhardt <ps@pks.im>
Mon, 27 Oct 2025 08:30:50 +0000 (09:30 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Oct 2025 20:57:17 +0000 (13:57 -0700)
When a supposedly no-op "git repack" runs across a second boundary,
because the command always touches the MIDX file and updates its
timestamp, "ls -l $GIT_DIR/objects/pack/" before and after the
operation can change, which causes such a test to fail.  Only
compare the *.pack files in the directory before and after the
operation to work around this flakyness.

Arguably, git-repack(1) should learn to not rewrite the MIDX in case
we know it is already up-to-date. But this is not a new problem
introduced via the new geometric maintenance task, so for now it
should be good enough to paper over the issue.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
[jc: taken from diff to v4 from v3 that was already merged to 'next']
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7900-maintenance.sh

index 0d76693feec08cc69865d0d83aaa4a8e003a911a..614184a0978f7913de7851c7809159feda7d0e21 100755 (executable)
@@ -500,9 +500,9 @@ test_expect_success 'geometric repacking task' '
 
                # Repacking should now cause a no-op geometric repack because
                # no packfiles need to be combined.
-               ls -l .git/objects/pack >before &&
+               ls -l .git/objects/pack/*.pack >before &&
                run_and_verify_geometric_pack 1 &&
-               ls -l .git/objects/pack >after &&
+               ls -l .git/objects/pack/*.pack >after &&
                test_cmp before after &&
 
                # This incremental change creates a new packfile that only