| 604 | } |
| 605 | |
| 606 | int unbundle(struct repository *r, struct bundle_header *header, |
| 607 | int bundle_fd, struct strvec *extra_index_pack_args, |
| 608 | struct unbundle_opts *opts) |
| 609 | { |
| 610 | struct child_process ip = CHILD_PROCESS_INIT; |
| 611 | struct unbundle_opts opts_fallback = { 0 }; |
| 612 | |
| 613 | if (!opts) |
| 614 | opts = &opts_fallback; |
| 615 | |
| 616 | if (verify_bundle(r, header, opts->flags)) { |
| 617 | close(bundle_fd); |
| 618 | return -1; |
| 619 | } |
| 620 | |
| 621 | strvec_pushl(&ip.args, "index-pack", "--fix-thin", "--stdin", NULL); |
| 622 | |
| 623 | /* If there is a filter, then we need to create the promisor pack. */ |
| 624 | if (header->filter.choice) |
| 625 | strvec_push(&ip.args, "--promisor=from-bundle"); |
| 626 | |
| 627 | if (opts->flags & VERIFY_BUNDLE_FSCK) |
| 628 | strvec_pushf(&ip.args, "--fsck-objects%s", |
| 629 | opts->fsck_msg_types ? opts->fsck_msg_types : ""); |
| 630 | |
| 631 | if (extra_index_pack_args) |
| 632 | strvec_pushv(&ip.args, extra_index_pack_args->v); |
| 633 | |
| 634 | ip.in = bundle_fd; |
| 635 | ip.no_stdout = 1; |
| 636 | ip.git_cmd = 1; |
| 637 | if (run_command(&ip)) |
| 638 | return error(_("index-pack died")); |
| 639 | return 0; |
| 640 | } |
no test coverage detected