]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t6500: use "ls -1" to snapshot ref database state
authorHan-Wen Nienhuys <hanwen@google.com>
Mon, 2 Aug 2021 16:53:35 +0000 (16:53 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 2 Aug 2021 20:17:21 +0000 (13:17 -0700)
By doing ls -1 .git/{reftable,refs/heads}, we can capture changes to both
reftable and packed/loose ref storage.

This relies on the fact that git-pack-refs (which we're looking for here)
changes the number (loose/packed storage) and/or names (reftable) files used for
ref storage.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6500-gc.sh

index 10c7ae7f09ce6d617aaf51b273c6d276dbf1e948..c2021267f2c558151567f274251844dd4abafb5c 100755 (executable)
@@ -241,7 +241,7 @@ test_expect_success 'background auto gc respects lock for all operations' '
 
        # create a ref whose loose presence we can use to detect a pack-refs run
        git update-ref refs/heads/should-be-loose HEAD &&
-       test_path_is_file .git/refs/heads/should-be-loose &&
+       (ls -1 .git/refs/heads .git/reftable >expect || true) &&
 
        # now fake a concurrent gc that holds the lock; we can use our
        # shell pid so that it looks valid.
@@ -258,7 +258,8 @@ test_expect_success 'background auto gc respects lock for all operations' '
 
        # our gc should exit zero without doing anything
        run_and_wait_for_auto_gc &&
-       test_path_is_file .git/refs/heads/should-be-loose
+       (ls -1 .git/refs/heads .git/reftable >actual || true) &&
+       test_cmp expect actual
 '
 
 # DO NOT leave a detached auto gc process running near the end of the