MCPcopy Create free account
hub / github.com/git/git / cmd_repack

Function cmd_repack

builtin/repack.c:135–644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135int cmd_repack(int argc,
136 const char **argv,
137 const char *prefix,
138 struct repository *repo)
139{
140 struct child_process cmd = CHILD_PROCESS_INIT;
141 struct string_list_item *item;
142 struct string_list names = STRING_LIST_INIT_DUP;
143 struct existing_packs existing = EXISTING_PACKS_INIT;
144 struct pack_geometry geometry = { 0 };
145 struct tempfile *refs_snapshot = NULL;
146 int i, ret;
147 int show_progress;
148
149 /* variables to be filled by option parsing */
150 struct repack_config_ctx config_ctx;
151 int delete_redundant = 0;
152 const char *unpack_unreachable = NULL;
153 int keep_unreachable = 0;
154 struct string_list keep_pack_list = STRING_LIST_INIT_NODUP;
155 struct pack_objects_args po_args = PACK_OBJECTS_ARGS_INIT;
156 struct pack_objects_args cruft_po_args = PACK_OBJECTS_ARGS_INIT;
157 enum repack_write_midx_mode write_midx = REPACK_WRITE_MIDX_NONE;
158 const char *cruft_expiration = NULL;
159 const char *expire_to = NULL;
160 const char *filter_to = NULL;
161 const char *opt_window = NULL;
162 const char *opt_window_memory = NULL;
163 const char *opt_depth = NULL;
164 const char *opt_threads = NULL;
165 unsigned long combine_cruft_below_size = 0ul;
166
167 struct option builtin_repack_options[] = {
168 OPT_BIT('a', NULL, &pack_everything,
169 N_("pack everything in a single pack"), ALL_INTO_ONE),
170 OPT_BIT('A', NULL, &pack_everything,
171 N_("same as -a, and turn unreachable objects loose"),
172 LOOSEN_UNREACHABLE | ALL_INTO_ONE),
173 OPT_BIT(0, "cruft", &pack_everything,
174 N_("same as -a, pack unreachable cruft objects separately"),
175 PACK_CRUFT),
176 OPT_STRING(0, "cruft-expiration", &cruft_expiration, N_("approxidate"),
177 N_("with --cruft, expire objects older than this")),
178 OPT_UNSIGNED(0, "combine-cruft-below-size",
179 &combine_cruft_below_size,
180 N_("with --cruft, only repack cruft packs smaller than this")),
181 OPT_UNSIGNED(0, "max-cruft-size", &cruft_po_args.max_pack_size,
182 N_("with --cruft, limit the size of new cruft packs")),
183 OPT_BOOL('d', NULL, &delete_redundant,
184 N_("remove redundant packs, and run git-prune-packed")),
185 OPT_BOOL('f', NULL, &po_args.no_reuse_delta,
186 N_("pass --no-reuse-delta to git-pack-objects")),
187 OPT_BOOL('F', NULL, &po_args.no_reuse_object,
188 N_("pass --no-reuse-object to git-pack-objects")),
189 OPT_INTEGER(0, "name-hash-version", &po_args.name_hash_version,
190 N_("specify the name hash version to use for grouping similar objects by path")),
191 OPT_BOOL(0, "path-walk", &po_args.path_walk,
192 N_("pass --path-walk to git-pack-objects")),

Callers

nothing calls this directly

Calls 15

list_objects_filter_initFunction · 0.85
parse_optionsFunction · 0.85
xstrdup_or_nullFunction · 0.85
is_bare_repositoryFunction · 0.85
odb_has_alternatesFunction · 0.85
warningFunction · 0.85
strbuf_addfFunction · 0.85
xmks_tempfileFunction · 0.85
midx_snapshot_refsFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected