midx-write: revert use of --stdin-packs

This reverts b7d6f23a171 (midx-write.c: use `--stdin-packs` when repacking, 2024-04-01) and then marks the test created in the previous change as passing. The fundamental issue with the reverted change is that the focus on pack-files separates the object selection from how the multi-pack-index selects a single pack-file for an object ID with multiple copies among the tracked pack-files. The change was made with the intention of improving delta compression in the resulting pack-file, but that can be resolved with the existing object list mechanism. There are other potential pitfalls of doing an object walk at this time if the repository is a blobless partial clone, and that will require additional testing on top of the one that changes here. Signed-off-by: Derrick Stolee <stolee@gmail.com> Acked-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Jul 18, 2024 at 19:55 UTC 8fb6d11fade8301f0af1074fe250b9d79544cb18
2 files changed +10 -10
midx-write.c
+9 -9
@@ -1474,8 +1474,7 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size,
1474 repo_config_get_bool(r, "repack.usedeltabaseoffset", &delta_base_offset);
1475 repo_config_get_bool(r, "repack.usedeltaislands", &use_delta_islands);
1476
1477 - strvec_pushl(&cmd.args, "pack-objects", "--stdin-packs", "--non-empty",
1478 - NULL);
1477 + strvec_push(&cmd.args, "pack-objects");
1478
1479 strvec_pushf(&cmd.args, "%s/pack/pack", object_dir);
1480
@@ -1499,15 +1498,16 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size,
1498 }
1499
1500 cmd_in = xfdopen(cmd.in, "w");
1502 - for (i = 0; i < m->num_packs; i++) {
1503 - struct packed_git *p = m->packs[i];
1504 - if (!p)
1501 +
1502 + for (i = 0; i < m->num_objects; i++) {
1503 + struct object_id oid;
1504 + uint32_t pack_int_id = nth_midxed_pack_int_id(m, i);
1505 +
1506 + if (!include_pack[pack_int_id])
1507 continue;
1508
1507 - if (include_pack[i])
1508 - fprintf(cmd_in, "%s\n", pack_basename(p));
1509 - else
1510 - fprintf(cmd_in, "^%s\n", pack_basename(p));
1509 + nth_midxed_object_oid(&oid, m, i);
1510 + fprintf(cmd_in, "%s\n", oid_to_hex(&oid));
1511 }
1512 fclose(cmd_in);
1513
t/t5319-multi-pack-index.sh
+1 -1
@@ -1004,7 +1004,7 @@ test_expect_success 'repack --batch-size=<large> repacks everything' '
1004 )
1005 '
1006
1007 -test_expect_failure 'repack/expire loop' '
1007 +test_expect_success 'repack/expire loop' '
1008 git init repack-expire &&
1009 test_when_finished "rm -fr repack-expire" &&
1010 (