]> git.ipfire.org Git - thirdparty/git.git/commitdiff
midx-write: revert use of --stdin-packs
authorDerrick Stolee <stolee@gmail.com>
Thu, 18 Jul 2024 19:55:46 +0000 (19:55 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Jul 2024 14:19:01 +0000 (07:19 -0700)
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>
midx-write.c
t/t5319-multi-pack-index.sh

index 65e69d2de787cf784bb1736c7d834ce1f8aeebaf..960cc46250ef8b0dbae200406cb9263b147662d3 100644 (file)
@@ -1474,8 +1474,7 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size,
        repo_config_get_bool(r, "repack.usedeltabaseoffset", &delta_base_offset);
        repo_config_get_bool(r, "repack.usedeltaislands", &use_delta_islands);
 
-       strvec_pushl(&cmd.args, "pack-objects", "--stdin-packs", "--non-empty",
-                    NULL);
+       strvec_push(&cmd.args, "pack-objects");
 
        strvec_pushf(&cmd.args, "%s/pack/pack", object_dir);
 
@@ -1499,15 +1498,16 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size,
        }
 
        cmd_in = xfdopen(cmd.in, "w");
-       for (i = 0; i < m->num_packs; i++) {
-               struct packed_git *p = m->packs[i];
-               if (!p)
+
+       for (i = 0; i < m->num_objects; i++) {
+               struct object_id oid;
+               uint32_t pack_int_id = nth_midxed_pack_int_id(m, i);
+
+               if (!include_pack[pack_int_id])
                        continue;
 
-               if (include_pack[i])
-                       fprintf(cmd_in, "%s\n", pack_basename(p));
-               else
-                       fprintf(cmd_in, "^%s\n", pack_basename(p));
+               nth_midxed_object_oid(&oid, m, i);
+               fprintf(cmd_in, "%s\n", oid_to_hex(&oid));
        }
        fclose(cmd_in);
 
index 327376233c571281736842016d8d447e9e6582d3..5cce0be19e6fd1d3544d8dd4777bc4ea9554e936 100755 (executable)
@@ -1004,7 +1004,7 @@ test_expect_success 'repack --batch-size=<large> repacks everything' '
        )
 '
 
-test_expect_failure 'repack/expire loop' '
+test_expect_success 'repack/expire loop' '
        git init repack-expire &&
        test_when_finished "rm -fr repack-expire" &&
        (