aboutsummaryrefslogtreecommitdiffstats
path: root/builtin
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2025-10-15 18:29:35 -0400
committerJunio C Hamano <gitster@pobox.com>2025-10-16 10:08:57 -0700
commit7ac4231b4283f4f8dc8447439730a5a2b8ed7eb4 (patch)
tree7564f0a71d36c39883012364b03a6db7529a7ff6 /builtin
parentrepack: move `pack_kept_objects` to `struct pack_objects_args` (diff)
downloadgit-7ac4231b4283f4f8dc8447439730a5a2b8ed7eb4.tar.gz
git-7ac4231b4283f4f8dc8447439730a5a2b8ed7eb4.zip
repack: move `write_filtered_pack()` out of the builtin
In a similar fashion as in previous commits, move the function `write_filtered_pack()` out of the builtin and into its own compilation unit. This function is now part of the repack.h API, but implemented in its own "repack-filtered.c" unit as it is a separate component from other kinds of repacking operations. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/repack.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/builtin/repack.c b/builtin/repack.c
index 3c6d7e91fd..f65880d8f6 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -106,52 +106,6 @@ static int repack_config(const char *var, const char *value,
return git_default_config(var, value, ctx, cb);
}
-static int write_filtered_pack(const struct write_pack_opts *opts,
- struct existing_packs *existing,
- struct string_list *names)
-{
- struct child_process cmd = CHILD_PROCESS_INIT;
- struct string_list_item *item;
- FILE *in;
- int ret;
- const char *caret;
- const char *pack_prefix = write_pack_opts_pack_prefix(opts);
-
- prepare_pack_objects(&cmd, opts->po_args, opts->destination);
-
- strvec_push(&cmd.args, "--stdin-packs");
-
- for_each_string_list_item(item, &existing->kept_packs)
- strvec_pushf(&cmd.args, "--keep-pack=%s", item->string);
-
- cmd.in = -1;
-
- ret = start_command(&cmd);
- if (ret)
- return ret;
-
- /*
- * Here 'names' contains only the pack(s) that were just
- * written, which is exactly the packs we want to keep. Also
- * 'existing_kept_packs' already contains the packs in
- * 'keep_pack_list'.
- */
- in = xfdopen(cmd.in, "w");
- for_each_string_list_item(item, names)
- fprintf(in, "^%s-%s.pack\n", pack_prefix, item->string);
- for_each_string_list_item(item, &existing->non_kept_packs)
- fprintf(in, "%s.pack\n", item->string);
- for_each_string_list_item(item, &existing->cruft_packs)
- fprintf(in, "%s.pack\n", item->string);
- caret = opts->po_args->pack_kept_objects ? "" : "^";
- for_each_string_list_item(item, &existing->kept_packs)
- fprintf(in, "%s%s.pack\n", caret, item->string);
- fclose(in);
-
- return finish_pack_objects_cmd(existing->repo->hash_algo, opts, &cmd,
- names);
-}
-
static void combine_small_cruft_packs(FILE *in, size_t combine_cruft_below_size,
struct existing_packs *existing)
{