#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "dir.h"
#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "parse-options.h"
#include "path.h"
#include "run-command.h"
#include "server-info.h"
#include "strbuf.h"
#include "string-list.h"
#include "strvec.h"
#include "midx.h"
#include "packfile.h"
#include "prune-packed.h"
#include "object-store-ll.h"
#include "promisor-remote.h"
#include "shallow.h"
#include "pack.h"
#include "pack-bitmap.h"
#include "refs.h"
#include "list-objects-filter-options.h"
#define ALL_INTO_ONE …
#define LOOSEN_UNREACHABLE …
#define PACK_CRUFT …
#define DELETE_PACK …
#define RETAIN_PACK …
static int pack_everything;
static int delta_base_offset = …;
static int pack_kept_objects = …;
static int write_bitmaps = …;
static int use_delta_islands;
static int run_update_server_info = …;
static char *packdir, *packtmp_name, *packtmp;
static const char *const git_repack_usage[] = …;
static const char incremental_bitmap_conflict_error[] = …
);
struct pack_objects_args { … };
static int repack_config(const char *var, const char *value,
const struct config_context *ctx, void *cb)
{ … }
static void pack_objects_args_release(struct pack_objects_args *args)
{ … }
struct existing_packs { … };
#define EXISTING_PACKS_INIT …
static int has_existing_non_kept_packs(const struct existing_packs *existing)
{ … }
static void pack_mark_for_deletion(struct string_list_item *item)
{ … }
static void pack_unmark_for_deletion(struct string_list_item *item)
{ … }
static int pack_is_marked_for_deletion(struct string_list_item *item)
{ … }
static void pack_mark_retained(struct string_list_item *item)
{ … }
static int pack_is_retained(struct string_list_item *item)
{ … }
static void mark_packs_for_deletion_1(struct string_list *names,
struct string_list *list)
{ … }
static void retain_cruft_pack(struct existing_packs *existing,
struct packed_git *cruft)
{ … }
static void mark_packs_for_deletion(struct existing_packs *existing,
struct string_list *names)
{ … }
static void remove_redundant_pack(const char *dir_name, const char *base_name)
{ … }
static void remove_redundant_packs_1(struct string_list *packs)
{ … }
static void remove_redundant_existing_packs(struct existing_packs *existing)
{ … }
static void existing_packs_release(struct existing_packs *existing)
{ … }
static void collect_pack_filenames(struct existing_packs *existing,
const struct string_list *extra_keep)
{ … }
static void prepare_pack_objects(struct child_process *cmd,
const struct pack_objects_args *args,
const char *out)
{ … }
static int write_oid(const struct object_id *oid,
struct packed_git *pack UNUSED,
uint32_t pos UNUSED, void *data)
{ … }
static struct { … } exts[] = …;
struct generated_pack_data { … };
static struct generated_pack_data *populate_pack_exts(const char *name)
{ … }
static int has_pack_ext(const struct generated_pack_data *data,
const char *ext)
{ … }
static void repack_promisor_objects(const struct pack_objects_args *args,
struct string_list *names)
{ … }
struct pack_geometry { … };
static uint32_t geometry_pack_weight(struct packed_git *p)
{ … }
static int geometry_cmp(const void *va, const void *vb)
{ … }
static void init_pack_geometry(struct pack_geometry *geometry,
struct existing_packs *existing,
const struct pack_objects_args *args)
{ … }
static void split_pack_geometry(struct pack_geometry *geometry)
{ … }
static struct packed_git *get_preferred_pack(struct pack_geometry *geometry)
{ … }
static void geometry_remove_redundant_packs(struct pack_geometry *geometry,
struct string_list *names,
struct existing_packs *existing)
{ … }
static void free_pack_geometry(struct pack_geometry *geometry)
{ … }
struct midx_snapshot_ref_data { … };
static int midx_snapshot_ref_one(const char *refname UNUSED,
const char *referent UNUSED,
const struct object_id *oid,
int flag UNUSED, void *_data)
{ … }
static void midx_snapshot_refs(struct tempfile *f)
{ … }
static void midx_included_packs(struct string_list *include,
struct existing_packs *existing,
struct string_list *names,
struct pack_geometry *geometry)
{ … }
static int write_midx_included_packs(struct string_list *include,
struct pack_geometry *geometry,
struct string_list *names,
const char *refs_snapshot,
int show_progress, int write_bitmaps)
{ … }
static void remove_redundant_bitmaps(struct string_list *include,
const char *packdir)
{ … }
static int finish_pack_objects_cmd(struct child_process *cmd,
struct string_list *names,
int local)
{ … }
static int write_filtered_pack(const struct pack_objects_args *args,
const char *destination,
const char *pack_prefix,
struct existing_packs *existing,
struct string_list *names)
{ … }
static int existing_cruft_pack_cmp(const void *va, const void *vb)
{ … }
static void collapse_small_cruft_packs(FILE *in, size_t max_size,
struct existing_packs *existing)
{ … }
static int write_cruft_pack(const struct pack_objects_args *args,
const char *destination,
const char *pack_prefix,
const char *cruft_expiration,
struct string_list *names,
struct existing_packs *existing)
{ … }
static const char *find_pack_prefix(const char *packdir, const char *packtmp)
{ … }
int cmd_repack(int argc,
const char **argv,
const char *prefix,
struct repository *repo UNUSED)
{ … }