]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'xx/disable-replace-when-building-midx'
authorJunio C Hamano <gitster@pobox.com>
Tue, 30 Apr 2024 21:49:41 +0000 (14:49 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 30 Apr 2024 21:49:42 +0000 (14:49 -0700)
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

builtin/multi-pack-index.c
t/t5326-multi-pack-bitmaps.sh

index a72aebecaa2f3aa96f802b635b4d55c5f122d56c..8360932d2e75577dbb416c5851d33556d3688233 100644 (file)
@@ -8,6 +8,7 @@
 #include "strbuf.h"
 #include "trace2.h"
 #include "object-store-ll.h"
+#include "replace-object.h"
 
 #define BUILTIN_MIDX_WRITE_USAGE \
        N_("git multi-pack-index [<options>] write [--preferred-pack=<pack>]" \
@@ -273,6 +274,8 @@ int cmd_multi_pack_index(int argc, const char **argv,
        };
        struct option *options = parse_options_concat(builtin_multi_pack_index_options, common_opts);
 
+       disable_replace_refs();
+
        git_config(git_default_config, NULL);
 
        if (the_repository &&
index 5d7d32184057da8765a7b777905d2fdfa3612594..cc7220b6c096f36088c3a7a03a02ce5a6823b4e6 100755 (executable)
@@ -434,6 +434,27 @@ test_expect_success 'tagged commits are selected for bitmapping' '
        )
 '
 
+test_expect_success 'do not follow replace objects for MIDX bitmap' '
+       rm -fr repo &&
+       git init repo &&
+       test_when_finished "rm -fr repo" &&
+       (
+               cd repo &&
+
+               test_commit A &&
+               test_commit B &&
+               git checkout --orphan=orphan A &&
+               test_commit orphan &&
+
+               git replace A HEAD &&
+               git repack -ad --write-midx --write-bitmap-index &&
+
+               # generating reachability bitmaps with replace refs
+               # enabled will result in broken clones
+               git clone --no-local --bare . clone.git
+       )
+'
+
 corrupt_file () {
        chmod a+w "$1" &&
        printf "bogus" | dd of="$1" bs=1 seek="12" conv=notrunc