Skip to content

Commit 55e5548

Browse files
committed
Merge branch 'xx/disable-replace-when-building-midx'
The procedure to build multi-pack-index got confused by the replace-refs mechanism, which has been corrected by disabling the latter. * xx/disable-replace-when-building-midx: midx: disable replace objects
2 parents c9f4301 + 93e2ae1 commit 55e5548

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

builtin/multi-pack-index.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "strbuf.h"
99
#include "trace2.h"
1010
#include "object-store-ll.h"
11+
#include "replace-object.h"
1112

1213
#define BUILTIN_MIDX_WRITE_USAGE \
1314
N_("git multi-pack-index [<options>] write [--preferred-pack=<pack>]" \
@@ -273,6 +274,8 @@ int cmd_multi_pack_index(int argc, const char **argv,
273274
};
274275
struct option *options = parse_options_concat(builtin_multi_pack_index_options, common_opts);
275276

277+
disable_replace_refs();
278+
276279
git_config(git_default_config, NULL);
277280

278281
if (the_repository &&

t/t5326-multi-pack-bitmaps.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,27 @@ test_expect_success 'tagged commits are selected for bitmapping' '
434434
)
435435
'
436436

437+
test_expect_success 'do not follow replace objects for MIDX bitmap' '
438+
rm -fr repo &&
439+
git init repo &&
440+
test_when_finished "rm -fr repo" &&
441+
(
442+
cd repo &&
443+
444+
test_commit A &&
445+
test_commit B &&
446+
git checkout --orphan=orphan A &&
447+
test_commit orphan &&
448+
449+
git replace A HEAD &&
450+
git repack -ad --write-midx --write-bitmap-index &&
451+
452+
# generating reachability bitmaps with replace refs
453+
# enabled will result in broken clones
454+
git clone --no-local --bare . clone.git
455+
)
456+
'
457+
437458
corrupt_file () {
438459
chmod a+w "$1" &&
439460
printf "bogus" | dd of="$1" bs=1 seek="12" conv=notrunc

0 commit comments

Comments
 (0)