mirror of
https://github.com/git/git.git
synced 2026-01-09 17:46:37 +00:00
repack: move pack_kept_objects to struct pack_objects_args
The "pack_kept_objects" variable is defined as static to the repack builtin, but is inherently related to the pack-objects arguments that the builtin uses when generating new packs. Move that field into the "struct pack_objects_args", and shuffle around where we append the corresponding command-line option when preparing a pack-objects process. Specifically: - `write_cruft_pack()` always wants to pass "--honor-pack-keep", so explicitly set the `pack_kept_objects` field to "0" when initializing the `write_pack_opts` struct before calling `write_cruft_pack()`. - `write_filtered_pack()` no longer needs to handle writing the command-line option "--honor-pack-keep" when preparing a pack-objects process, since its call to `prepare_pack_objects()` will have already taken care of that. `write_filtered_pack()` also reads the `pack_kept_objects` field to determine whether to write the existing kept packs with a leading "^" character, so update that to read through the `po_args` pointer instead. - `cmd_repack()` also no longer has to write the "--honor-pack-keep" flag explicitly, since this is also handled via its call to `prepare_pack_objects()`. Since there is a default value for "pack_kept_objects" that relies on whether or not we are writing a bitmap (and not writing a MIDX), extract a default initializer for `struct pack_objects_args` that keeps this conditional default behavior. 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
fa0787a6cc
commit
d278970aef
@@ -27,8 +27,7 @@ static int pack_geometry_cmp(const void *va, const void *vb)
|
||||
|
||||
void pack_geometry_init(struct pack_geometry *geometry,
|
||||
struct existing_packs *existing,
|
||||
const struct pack_objects_args *args,
|
||||
int pack_kept_objects)
|
||||
const struct pack_objects_args *args)
|
||||
{
|
||||
struct packfile_store *packs = existing->repo->objects->packfiles;
|
||||
struct packed_git *p;
|
||||
@@ -43,7 +42,7 @@ void pack_geometry_init(struct pack_geometry *geometry,
|
||||
*/
|
||||
continue;
|
||||
|
||||
if (!pack_kept_objects) {
|
||||
if (!args->pack_kept_objects) {
|
||||
/*
|
||||
* Any pack that has its pack_keep bit set will
|
||||
* appear in existing->kept_packs below, but
|
||||
|
||||
Reference in New Issue
Block a user