| 297 | } |
| 298 | |
| 299 | static 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)) |
no test coverage detected