Skip to content

Commit 6885cd7

Browse files
ttaylorrgitster
authored andcommitted
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 <[email protected]> Helped-by: Jeff King <[email protected]> Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ec8e776 commit 6885cd7

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

t/t5325-reverse-index.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,27 @@ test_expect_success 'reverse index is not generated when available on disk' '
9494
--batch-check="%(objectsize:disk)" <tip
9595
'
9696

97+
test_expect_success 'revindex in-memory vs on-disk' '
98+
git init repo &&
99+
test_when_finished "rm -fr repo" &&
100+
(
101+
cd repo &&
102+
103+
test_commit commit &&
104+
105+
git rev-list --objects --no-object-names --all >objects &&
106+
107+
git -c pack.writeReverseIndex=false repack -ad &&
108+
test_path_is_missing $packdir/pack-*.rev &&
109+
git cat-file --batch-check="%(objectsize:disk) %(objectname)" \
110+
<objects >in-core &&
111+
112+
git -c pack.writeReverseIndex=true repack -ad &&
113+
test_path_is_file $packdir/pack-*.rev &&
114+
git cat-file --batch-check="%(objectsize:disk) %(objectname)" \
115+
<objects >on-disk &&
116+
117+
test_cmp on-disk in-core
118+
)
119+
'
97120
test_done

0 commit comments

Comments
 (0)