Here is an additional reroll of my series to create MIDXs that do not include a repository's cruft pack(s). Nearly everything is identical between this version and the previous (v5), with two exceptions: - Adjusted where to split a long line in show_object_pack_hint(). - Fixed a test failure with GIT_TEST_MULTI_PACK_INDEX_WRITE_INCREMENTAL Thanks for Junio and Peff (respectively) for pointing out each of the above. As usual, a range-diff is attached for convenience. Thanks in advance for any review :-). Taylor Blau (9): pack-objects: use standard option incompatibility functions pack-objects: limit scope in 'add_object_entry_from_pack()' pack-objects: factor out handling '--stdin-packs' pack-objects: declare 'rev_info' for '--stdin-packs' earlier pack-objects: perform name-hash traversal for unpacked objects pack-objects: fix typo in 'show_object_pack_hint()' pack-objects: swap 'show_{object,commit}_pack_hint' pack-objects: introduce '--stdin-packs=follow' repack: exclude cruft pack(s) from the MIDX where possible Documentation/config/repack.adoc | 7 + Documentation/git-pack-objects.adoc | 10 +- builtin/pack-objects.c | 193 ++++++++++++++++++---------- builtin/repack.c | 187 ++++++++++++++++++++++++--- t/t5331-pack-objects-stdin.sh | 122 +++++++++++++++++- t/t7704-repack-cruft.sh | 145 +++++++++++++++++++++ 6 files changed, 573 insertions(+), 91 deletions(-) Range-diff against v5: 1: 19fab7a35c = 1: 8e7b2dacc7 pack-objects: use standard option incompatibility functions 2: 6f2d3f17a4 = 2: 86fb36d317 pack-objects: limit scope in 'add_object_entry_from_pack()' 3: c06f5b264a = 3: 19e8c789e9 pack-objects: factor out handling '--stdin-packs' 4: 40d7d87cb1 = 4: c9f874eb94 pack-objects: declare 'rev_info' for '--stdin-packs' earlier 5: 5e2599436c = 5: 6b0149a32d pack-objects: perform name-hash traversal for unpacked objects 6: 3a5c3f63d8 = 6: f31dd00a98 pack-objects: fix typo in 'show_object_pack_hint()' 7: 796e8743f8 = 7: 5d15055985 pack-objects: swap 'show_{object,commit}_pack_hint' 8: 8830775beb ! 8: 3699c25337 pack-objects: introduce '--stdin-packs=follow' @@ builtin/pack-objects.c: static int add_object_entry_from_pack(const struct objec - return; + enum stdin_packs_mode mode = *(enum stdin_packs_mode *)data; + if (mode == STDIN_PACKS_MODE_FOLLOW) { -+ if (object->type == OBJ_BLOB && !has_object(the_repository, -+ &object->oid, 0)) ++ if (object->type == OBJ_BLOB && ++ !has_object(the_repository, &object->oid, 0)) + return; + add_object_entry(&object->oid, object->type, name, 0); + } else { 9: 8f505179cc ! 9: f519777059 repack: exclude cruft pack(s) from the MIDX where possible @@ builtin/repack.c: int cmd_repack(int argc, string_list_sort(&names); + if (get_local_multi_pack_index(the_repository)) { -+ uint32_t i; + struct multi_pack_index *m = + get_local_multi_pack_index(the_repository); + -+ ALLOC_ARRAY(midx_pack_names, m->num_packs); -+ for (i = 0; i < m->num_packs; i++) -+ midx_pack_names[midx_pack_names_nr++] = xstrdup(m->pack_names[i]); ++ ALLOC_ARRAY(midx_pack_names, ++ m->num_packs + m->num_packs_in_base); ++ ++ for (; m; m = m->base_midx) ++ for (uint32_t i = 0; i < m->num_packs; i++) ++ midx_pack_names[midx_pack_names_nr++] = ++ xstrdup(m->pack_names[i]); + } + close_object_store(the_repository->objects); base-commit: f9aa0eedb37eb94d9d3711ef0d565fd7cb3b6148 -- 2.50.0.61.g1981e40f2d