mirror of
https://github.com/git/git.git
synced 2024-10-28 12:59:41 +01:00
fcb2205b77
Now that the rest of the MIDX subsystem and relevant callers have been updated to learn about how to read and process incremental MIDX chains, let's finally update the implementation in `write_midx_internal()` to be able to write incremental MIDX chains. This new feature is available behind the `--incremental` option for the `multi-pack-index` builtin, like so: $ git multi-pack-index write --incremental The implementation for doing so is relatively straightforward, and boils down to a handful of different kinds of changes implemented in this patch: - The `compute_sorted_entries()` function is taught to reject objects which appear in any existing MIDX layer. - Functions like `write_midx_revindex()` are adjusted to write pack_order values which are offset by the number of objects in the base MIDX layer. - The end of `write_midx_internal()` is adjusted to move non-incremental MIDX files when necessary (i.e. when creating an incremental chain with an existing non-incremental MIDX in the repository). There are a handful of other changes that are introduced, like new functions to clear incremental MIDX files that are unrelated to the current chain (using the same "keep_hash" mechanism as in the non-incremental case). The tests explicitly exercising the new incremental MIDX feature are relatively limited for two reasons: 1. Most of the "interesting" behavior is already thoroughly covered in t5319-multi-pack-index.sh, which handles the core logic of reading objects through a MIDX. The new tests in t5334-incremental-multi-pack-index.sh are mostly focused on creating and destroying incremental MIDXs, as well as stitching their results together across layers. 2. A new GIT_TEST environment variable is added called "GIT_TEST_MULTI_PACK_INDEX_WRITE_INCREMENTAL", which modifies the entire test suite to write incremental MIDXs after repacking when combined with the "GIT_TEST_MULTI_PACK_INDEX" variable. This exercises the long tail of other interesting behavior that is defined implicitly throughout the rest of the CI suite. It is likewise added to the linux-TEST-vars job. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
43 lines
983 B
Bash
Executable file
43 lines
983 B
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='exercise basic multi-pack bitmap functionality (.rev files)'
|
|
|
|
. ./test-lib.sh
|
|
. "${TEST_DIRECTORY}/lib-bitmap.sh"
|
|
|
|
# We'll be writing our own MIDX, so avoid getting confused by the automatic
|
|
# ones.
|
|
GIT_TEST_MULTI_PACK_INDEX=0
|
|
GIT_TEST_MULTI_PACK_INDEX_WRITE_INCREMENTAL=0
|
|
|
|
# Unlike t5326, this test exercise multi-pack bitmap functionality where the
|
|
# object order is stored in a separate .rev file.
|
|
GIT_TEST_MIDX_WRITE_REV=1
|
|
GIT_TEST_MIDX_READ_RIDX=0
|
|
export GIT_TEST_MIDX_WRITE_REV
|
|
export GIT_TEST_MIDX_READ_RIDX
|
|
|
|
test_midx_bitmap_rev () {
|
|
writeLookupTable=false
|
|
|
|
for i in "$@"
|
|
do
|
|
case $i in
|
|
"pack.writeBitmapLookupTable") writeLookupTable=true;;
|
|
esac
|
|
done
|
|
|
|
test_expect_success 'setup bitmap config' '
|
|
rm -rf * .git &&
|
|
git init &&
|
|
git config pack.writeBitmapLookupTable '"$writeLookupTable"'
|
|
'
|
|
|
|
midx_bitmap_core rev
|
|
midx_bitmap_partial_tests rev
|
|
}
|
|
|
|
test_midx_bitmap_rev
|
|
test_midx_bitmap_rev "pack.writeBitmapLookupTable"
|
|
|
|
test_done
|