]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'tb/midx-incremental-custom-base' into seen
authorJunio C Hamano <gitster@pobox.com>
Thu, 30 Jul 2026 17:44:34 +0000 (10:44 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 Jul 2026 17:44:34 +0000 (10:44 -0700)
The 'git multi-pack-index write --incremental' command has been
corrected to properly honor the '--base' option.  Previously, the
custom base was ignored by the normal write path; packs from layers
above the selected base were incorrectly skipped by the pack exclusion
logic, and reachability closure for bitmaps was broken.

* tb/midx-incremental-custom-base:
  midx-write: include packs above custom incremental base
  midx: pass custom '--base' through incremental writes
  t5334: expose shared `nth_line()` helper

1  2 
builtin/multi-pack-index.c
builtin/repack.c
midx-write.c
midx.h
t/t5334-incremental-multi-pack-index.sh
t/t5335-compact-multi-pack-index.sh

index 6e73c85cde324f74b2a3165056f886113de6df00,949bfa796b28a59c90d17b638df28cd5b9234079..84d2467cc7520c784d6899594da212ce987e9897
@@@ -224,8 -223,9 +224,9 @@@ static int cmd_multi_pack_index_write(i
  
        }
  
 -      ret = write_midx_file(source, opts.preferred_pack,
 +      ret = write_midx_file(source->packed, opts.preferred_pack,
-                             opts.refs_snapshot, opts.flags);
+                             opts.refs_snapshot, opts.incremental_base,
+                             opts.flags);
  
        free(opts.refs_snapshot);
        return ret;
index db504d673fcf522690f62e546899eaace7ccaaac,0092a72a996caeff5ffb9b1b8cd13de0e5a39379..49385c885b316b27f9526ea3a5409235bf7740a8
@@@ -627,12 -626,10 +627,12 @@@ int cmd_repack(int argc
                update_server_info(repo, 0);
  
        if (git_env_bool(GIT_TEST_MULTI_PACK_INDEX, 0)) {
 +              struct odb_source_files *files = odb_source_files_downcast(existing.source);
                unsigned flags = 0;
 +
                if (git_env_bool(GIT_TEST_MULTI_PACK_INDEX_WRITE_INCREMENTAL, 0))
                        flags |= MIDX_WRITE_INCREMENTAL;
-               write_midx_file(files->packed, NULL, NULL, flags);
 -              write_midx_file(existing.source, NULL, NULL, NULL, flags);
++              write_midx_file(files->packed, NULL, NULL, NULL, flags);
        }
  
  cleanup:
diff --cc midx-write.c
index 580724d21a677f7ad5a579018c2c3adca4b3ba29,c50fdb5c6d17c3b8c3cde7860013bf0c89e0dd8b..d0adefe6cef2157ec4fc8212f3dbe5767d6068cb
@@@ -1848,9 -1853,10 +1854,10 @@@ cleanup
        return result;
  }
  
 -int write_midx_file(struct odb_source *source,
 +int write_midx_file(struct odb_source_packed *source,
                    const char *preferred_pack_name,
                    const char *refs_snapshot,
+                   const char *incremental_base,
                    unsigned flags)
  {
        struct write_midx_opts opts = {
diff --cc midx.h
index 939c18e5885e6f7ec619d74ef011c0a77d559be0,92ed29d913d9a39b1ed1d35e451e5a9f6cec49d2..e35db74905a5daf547f3c2aab9287aaa87ebbc82
--- 1/midx.h
--- 2/midx.h
+++ b/midx.h
@@@ -129,10 -129,10 +129,10 @@@ int prepare_multi_pack_index_one(struc
   * Variant of write_midx_file which writes a MIDX containing only the packs
   * specified in packs_to_include.
   */
 -int write_midx_file(struct odb_source *source,
 +int write_midx_file(struct odb_source_packed *source,
                    const char *preferred_pack_name, const char *refs_snapshot,
-                   unsigned flags);
+                   const char *incremental_base, unsigned flags);
 -int write_midx_file_only(struct odb_source *source,
 +int write_midx_file_only(struct odb_source_packed *source,
                         struct string_list *packs_to_include,
                         const char *preferred_pack_name,
                         const char *refs_snapshot,
Simple merge