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:
authorDerrick Stolee <stolee@gmail.com>2018-07-12 22:39:33 +0300
committerJunio C Hamano <gitster@pobox.com>2018-07-20 21:27:28 +0300
commitc4d25228ebb22a60f1fcb267e19c503bab708cdc (patch)
tree8367a0857c798421013fae47e8006cdab8d5a4af /t/t5319-multi-pack-index.sh
parent662148c4356620f6567b0a689602079339ebadb7 (diff)
config: create core.multiPackIndex setting
The core.multiPackIndex config setting controls the multi-pack- index (MIDX) feature. If false, the setting will disable all reads from the multi-pack-index file. Read this config setting in the new prepare_multi_pack_index_one() which is called during prepare_packed_git(). This check is run once per repository. Add comparison commands in t5319-multi-pack-index.sh to check typical Git behavior remains the same as the config setting is turned on and off. This currently includes 'git rev-list' and 'git log' commands to trigger several object database reads. Currently, these would only catch an error in the prepare_multi_pack_index_one(), but with later commits will catch errors in object lookups, abbreviations, and approximate object counts. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5319-multi-pack-index.sh')
-rwxr-xr-xt/t5319-multi-pack-index.sh51
1 files changed, 38 insertions, 13 deletions
diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh
index 4a4fa26f7a..b9661c7c66 100755
--- a/t/t5319-multi-pack-index.sh
+++ b/t/t5319-multi-pack-index.sh
@@ -3,6 +3,8 @@
test_description='multi-pack-indexes'
. ./test-lib.sh
+objdir=.git/objects
+
midx_read_expect () {
NUM_PACKS=$1
NUM_OBJECTS=$2
@@ -76,18 +78,35 @@ test_expect_success 'create objects' '
'
test_expect_success 'write midx with one v1 pack' '
- pack=$(git pack-objects --index-version=1 pack/test <obj-list) &&
- test_when_finished rm pack/test-$pack.pack pack/test-$pack.idx pack/multi-pack-index &&
- git multi-pack-index --object-dir=. write &&
- midx_read_expect 1 18 4 .
+ pack=$(git pack-objects --index-version=1 $objdir/pack/test <obj-list) &&
+ test_when_finished rm $objdir/pack/test-$pack.pack \
+ $objdir/pack/test-$pack.idx $objdir/pack/multi-pack-index &&
+ git multi-pack-index --object-dir=$objdir write &&
+ midx_read_expect 1 18 4 $objdir
'
+midx_git_two_modes () {
+ git -c core.multiPackIndex=false $1 >expect &&
+ git -c core.multiPackIndex=true $1 >actual &&
+ test_cmp expect actual
+}
+
+compare_results_with_midx () {
+ MSG=$1
+ test_expect_success "check normal git operations: $MSG" '
+ midx_git_two_modes "rev-list --objects --all" &&
+ midx_git_two_modes "log --raw"
+ '
+}
+
test_expect_success 'write midx with one v2 pack' '
- git pack-objects --index-version=2,0x40 pack/test <obj-list &&
- git multi-pack-index --object-dir=. write &&
- midx_read_expect 1 18 4 .
+ git pack-objects --index-version=2,0x40 $objdir/pack/test <obj-list &&
+ git multi-pack-index --object-dir=$objdir write &&
+ midx_read_expect 1 18 4 $objdir
'
+compare_results_with_midx "one v2 pack"
+
test_expect_success 'add more objects' '
for i in $(test_seq 6 10)
do
@@ -97,25 +116,31 @@ test_expect_success 'add more objects' '
'
test_expect_success 'write midx with two packs' '
- git pack-objects --index-version=1 pack/test-2 <obj-list &&
- git multi-pack-index --object-dir=. write &&
- midx_read_expect 2 34 4 .
+ git pack-objects --index-version=1 $objdir/pack/test-2 <obj-list &&
+ git multi-pack-index --object-dir=$objdir write &&
+ midx_read_expect 2 34 4 $objdir
'
+compare_results_with_midx "two packs"
+
test_expect_success 'add more packs' '
for j in $(test_seq 11 20)
do
generate_objects $j &&
commit_and_list_objects &&
- git pack-objects --index-version=2 pack/test-pack <obj-list
+ git pack-objects --index-version=2 $objdir/pack/test-pack <obj-list
done
'
+compare_results_with_midx "mixed mode (two packs + extra)"
+
test_expect_success 'write midx with twelve packs' '
- git multi-pack-index --object-dir=. write &&
- midx_read_expect 12 74 4 .
+ git multi-pack-index --object-dir=$objdir write &&
+ midx_read_expect 12 74 4 $objdir
'
+compare_results_with_midx "twelve packs"
+
# usage: corrupt_data <file> <pos> [<data>]
corrupt_data () {
file=$1