Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2021-01-26 02:37:46 +0300
committerJunio C Hamano <gitster@pobox.com>2021-01-26 05:32:44 +0300
commitec8e7760ac38ef426f87ec738454e574be53a00e (patch)
tree03da0ca6bab1e384f5a2823705de6fa97f71938d /t/t5325-reverse-index.sh
parente8c58f894b4d5369779e06ff7dc03fb0706c930a (diff)
pack-revindex: ensure that on-disk reverse indexes are given precedence
When an on-disk reverse index exists, there is no need to generate one in memory. In fact, doing so can be slow, and require large amounts of the heap. Let's make sure that we treat the on-disk reverse index with precedence (i.e., that when it exists, we don't bother trying to generate an equivalent one in memory) by teaching Git how to conditionally die() when generating a reverse index in memory. Then, add a test to ensure that when (a) an on-disk reverse index exists, and (b) when setting GIT_TEST_REV_INDEX_DIE_IN_MEMORY, that we do not die, implying that we read from the on-disk one. 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-xt/t5325-reverse-index.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/t/t5325-reverse-index.sh b/t/t5325-reverse-index.sh
index be452bb343..a344b18d7e 100755
--- a/t/t5325-reverse-index.sh
+++ b/t/t5325-reverse-index.sh
@@ -85,4 +85,13 @@ test_expect_success 'pack-objects respects pack.writeReverseIndex' '
test_path_is_file pack-1-*.rev
'
+test_expect_success 'reverse index is not generated when available on disk' '
+ test_index_pack true &&
+ test_path_is_file $rev &&
+
+ git rev-parse HEAD >tip &&
+ GIT_TEST_REV_INDEX_DIE_IN_MEMORY=1 git cat-file \
+ --batch-check="%(objectsize:disk)" <tip
+'
+
test_done