builtin/pack-objects.c: support --max-pack-size
with --cruft
When pack-objects learned the `--cruft` option back in b757353676
(builtin/pack-objects.c: --cruft without expiration, 2022-05-20), we
explicitly forbade `--cruft` with `--max-pack-size`.
At the time, there was no specific rationale given in the patch for not
supporting the `--max-pack-size` option with `--cruft`. (As best I can
remember, it's because we were trying to push users towards only ever
having a single cruft pack, but I cannot be sure).
However, `--max-pack-size` is flexible enough that it already works with
`--cruft` and can shard unreachable objects across multiple cruft packs,
creating separate ".mtimes" files as appropriate. In fact, the
`--max-pack-size` option worked with `--cruft` as far back as
b757353676!
This is because we overwrite the `written_list`, and pass down the
appropriate length, i.e. the number of objects written in each pack
shard.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
e741c07872
commit
61568efa95
@ -720,7 +720,6 @@ static int write_cruft_pack(const struct pack_objects_args *args,
|
||||
|
||||
strvec_push(&cmd.args, "--honor-pack-keep");
|
||||
strvec_push(&cmd.args, "--non-empty");
|
||||
strvec_push(&cmd.args, "--max-pack-size=0");
|
||||
|
||||
cmd.in = -1;
|
||||
|
||||
@ -1048,6 +1047,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
|
||||
cruft_po_args.depth = po_args.depth;
|
||||
if (!cruft_po_args.threads)
|
||||
cruft_po_args.threads = po_args.threads;
|
||||
if (!cruft_po_args.max_pack_size)
|
||||
cruft_po_args.max_pack_size = po_args.max_pack_size;
|
||||
|
||||
cruft_po_args.local = po_args.local;
|
||||
cruft_po_args.quiet = po_args.quiet;
|
||||
|
Reference in New Issue
Block a user