| 483 | } |
| 484 | |
| 485 | static int midx_compaction_step_exec_compact(struct midx_compaction_step *step, |
| 486 | struct repack_write_midx_opts *opts) |
| 487 | { |
| 488 | struct child_process cmd = CHILD_PROCESS_INIT; |
| 489 | struct strbuf buf = STRBUF_INIT; |
| 490 | FILE *out = NULL; |
| 491 | int ret; |
| 492 | |
| 493 | repack_prepare_midx_command(&cmd, opts, "compact"); |
| 494 | strvec_pushl(&cmd.args, "--incremental", "--no-write-chain-file", |
| 495 | midx_get_checksum_hex(step->u.compact.from), |
| 496 | midx_get_checksum_hex(step->u.compact.to), NULL); |
| 497 | |
| 498 | cmd.out = -1; |
| 499 | |
| 500 | ret = start_command(&cmd); |
| 501 | if (ret) |
| 502 | goto out; |
| 503 | |
| 504 | out = xfdopen(cmd.out, "r"); |
| 505 | while (strbuf_getline_lf(&buf, out) != EOF) { |
| 506 | if (step->csum) { |
| 507 | ret = error(_("unexpected MIDX output: '%s'"), buf.buf); |
| 508 | fclose(out); |
| 509 | out = NULL; |
| 510 | finish_command(&cmd); |
| 511 | goto out; |
| 512 | } |
| 513 | step->csum = strbuf_detach(&buf, NULL); |
| 514 | } |
| 515 | |
| 516 | ret = finish_command(&cmd); |
| 517 | |
| 518 | out: |
| 519 | if (out) |
| 520 | fclose(out); |
| 521 | strbuf_release(&buf); |
| 522 | |
| 523 | return ret; |
| 524 | } |
| 525 | |
| 526 | static int midx_compaction_step_exec(struct midx_compaction_step *step, |
| 527 | struct repack_write_midx_opts *opts, |
no test coverage detected