Skip to content

Commit afb13f7

Browse files
committed
Merge branch 'jk/midx-write-v1-by-default' into jch
Avoid breaking older versions of Git and its reimplementations by writing version 2 MIDX files by default. * jk/midx-write-v1-by-default: MIDX: revert the default version to v1
2 parents d7b0996 + 8e94460 commit afb13f7

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)