diff options
author | Taylor Blau <me@ttaylorr.com> | 2021-01-29 01:32:02 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-01-29 06:51:51 (GMT) |
commit | 6885cd7dc573b1750b8d895820b8b2f56285f070 (patch) | |
tree | 8e3fc04b46fe7a9e28bdb44b63588ae009fdf14d /t/t5325-reverse-index.sh | |
parent | ec8e7760ac38ef426f87ec738454e574be53a00e (diff) | |
download | git-6885cd7dc573b1750b8d895820b8b2f56285f070.zip git-6885cd7dc573b1750b8d895820b8b2f56285f070.tar.gz git-6885cd7dc573b1750b8d895820b8b2f56285f070.tar.bz2 |
t5325: check both on-disk and in-memory reverse index
Right now, the test suite can be run with 'GIT_TEST_WRITE_REV_INDEX=1'
in the environment, which causes all operations which write a pack to
also write a .rev file.
To prepare for when that eventually becomes the default, we should
continue to test the in-memory reverse index, too, in order to avoid
losing existing coverage. Unfortunately, explicit existing coverage is
rather sparse, so only a basic test is added that compares the result of
git rev-list --objects --no-object-names --all |
git cat-file --batch-check='%(objectsize:disk) %(objectname)'
with and without an on-disk reverse index.
Suggested-by: Jeff King <peff@peff.net>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5325-reverse-index.sh')
-rwxr-xr-x | t/t5325-reverse-index.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/t/t5325-reverse-index.sh b/t/t5325-reverse-index.sh index a344b18..da453f6 100755 --- a/t/t5325-reverse-index.sh +++ b/t/t5325-reverse-index.sh @@ -94,4 +94,27 @@ test_expect_success 'reverse index is not generated when available on disk' ' --batch-check="%(objectsize:disk)" <tip ' +test_expect_success 'revindex in-memory vs on-disk' ' + git init repo && + test_when_finished "rm -fr repo" && + ( + cd repo && + + test_commit commit && + + git rev-list --objects --no-object-names --all >objects && + + git -c pack.writeReverseIndex=false repack -ad && + test_path_is_missing $packdir/pack-*.rev && + git cat-file --batch-check="%(objectsize:disk) %(objectname)" \ + <objects >in-core && + + git -c pack.writeReverseIndex=true repack -ad && + test_path_is_file $packdir/pack-*.rev && + git cat-file --batch-check="%(objectsize:disk) %(objectname)" \ + <objects >on-disk && + + test_cmp on-disk in-core + ) +' test_done |