Skip to content

Commit 8e94460

Browse files
peffgitster
authored andcommitted
MIDX: revert the default version to v1
Dscho reports that fetching into a repository with Git 2.54-rc2 made it unusable with Git 2.53, as the recent code by default writes version 2 multi-pack-index files. Version 2 is the base of more advanced features to come, but using it where these features are not used is a strict regression. As deployed versions of Git and its reimplementations may not be ready for the format bump, let's revert the default version of MIDX file we write back to V1, and adjust tests that exercise V2-specific features to explicitly request V2. Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 105a22c commit 8e94460

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

midx-write.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,7 @@ static int write_midx_internal(struct write_midx_opts *opts)
12591259
struct tempfile *incr;
12601260
struct write_midx_context ctx = {
12611261
.preferred_pack_idx = NO_PREFERRED_PACK,
1262-
.version = MIDX_VERSION_V2,
1262+
.version = MIDX_VERSION_V1,
12631263
};
12641264
struct multi_pack_index *midx_to_free = NULL;
12651265
int bitmapped_packs_concat_len = 0;

t/t5319-multi-pack-index.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ midx_read_expect () {
1919
NUM_CHUNKS=$3
2020
OBJECT_DIR=$4
2121
EXTRA_CHUNKS="$5"
22+
# This reflects the default midx version we write; it should switch
23+
# to 2 if we flip the default.
24+
VERSION=1
2225
{
2326
cat <<-EOF &&
24-
header: 4d494458 2 $HASH_LEN $NUM_CHUNKS $NUM_PACKS
27+
header: 4d494458 $VERSION $HASH_LEN $NUM_CHUNKS $NUM_PACKS
2528
chunks: pack-names oid-fanout oid-lookup object-offsets$EXTRA_CHUNKS
2629
num_objects: $NUM_OBJECTS
2730
packs:

t/t5335-compact-multi-pack-index.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ test_midx_layer_object_uniqueness () {
5757
done <$midx_chain
5858
}
5959

60+
# MIDX compaction requires the v2 format, so make it the default
61+
# for the rest of this script. We check below that trying
62+
# compaction with v1 fails using "git -c", which will override this.
63+
test_expect_success 'set midx version config' '
64+
git config --global midx.version 2
65+
'
66+
6067
test_expect_success 'MIDX compaction with lex-ordered pack names' '
6168
git init midx-compact-lex-order &&
6269
(

0 commit comments

Comments
 (0)