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

Function create_pack_file

upload-pack.c:299–520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297}
298
299static void create_pack_file(struct upload_pack_data *pack_data,
300 const struct string_list *uri_protocols)
301{
302 struct child_process pack_objects = CHILD_PROCESS_INIT;
303 struct output_state *output_state = xcalloc(1, sizeof(struct output_state));
304 char progress[128];
305 char abort_msg[] = "aborting due to possible repository "
306 "corruption on the remote side.";
307 uint64_t last_sent_ms = 0;
308 ssize_t sz;
309 int i;
310 FILE *pipe_fd;
311
312 if (!pack_data->pack_objects_hook)
313 pack_objects.git_cmd = 1;
314 else {
315 strvec_push(&pack_objects.args, pack_data->pack_objects_hook);
316 strvec_push(&pack_objects.args, "git");
317 pack_objects.use_shell = 1;
318 }
319
320 if (pack_data->shallow_nr) {
321 strvec_push(&pack_objects.args, "--shallow-file");
322 strvec_push(&pack_objects.args, "");
323 }
324 strvec_push(&pack_objects.args, "pack-objects");
325 strvec_push(&pack_objects.args, "--revs");
326 if (pack_data->use_thin_pack)
327 strvec_push(&pack_objects.args, "--thin");
328
329 strvec_push(&pack_objects.args, "--stdout");
330 if (pack_data->shallow_nr)
331 strvec_push(&pack_objects.args, "--shallow");
332 if (!pack_data->no_progress)
333 strvec_push(&pack_objects.args, "--progress");
334 if (pack_data->use_ofs_delta)
335 strvec_push(&pack_objects.args, "--delta-base-offset");
336 if (pack_data->use_include_tag)
337 strvec_push(&pack_objects.args, "--include-tag");
338 if (repo_has_accepted_promisor_remote(the_repository))
339 strvec_push(&pack_objects.args, "--missing=allow-promisor");
340 if (pack_data->filter_options.choice) {
341 const char *spec =
342 expand_list_objects_filter_spec(&pack_data->filter_options);
343 strvec_pushf(&pack_objects.args, "--filter=%s", spec);
344 }
345 if (uri_protocols) {
346 for (i = 0; i < uri_protocols->nr; i++)
347 strvec_pushf(&pack_objects.args, "--uri-protocol=%s",
348 uri_protocols->items[i].string);
349 }
350
351 pack_objects.in = -1;
352 pack_objects.out = -1;
353 pack_objects.err = -1;
354 pack_objects.clean_on_exit = 1;
355
356 if (start_command(&pack_objects))

Callers 2

upload_packFunction · 0.85
upload_pack_v2Function · 0.85

Calls 15

xcallocFunction · 0.85
strvec_pushFunction · 0.85
strvec_pushfFunction · 0.85
start_commandFunction · 0.85
xfdopenFunction · 0.85
for_each_commit_graftFunction · 0.85
oid_to_hexFunction · 0.85
getnanotimeFunction · 0.85
reset_timeoutFunction · 0.85
pollFunction · 0.85

Tested by

no test coverage detected