| 2534 | } |
| 2535 | |
| 2536 | static void report(struct command *commands, const char *unpack_status) |
| 2537 | { |
| 2538 | struct command *cmd; |
| 2539 | struct strbuf buf = STRBUF_INIT; |
| 2540 | |
| 2541 | packet_buf_write(&buf, "unpack %s\n", |
| 2542 | unpack_status ? unpack_status : "ok"); |
| 2543 | for (cmd = commands; cmd; cmd = cmd->next) { |
| 2544 | if (!cmd->error_string) |
| 2545 | packet_buf_write(&buf, "ok %s\n", |
| 2546 | cmd->ref_name); |
| 2547 | else |
| 2548 | packet_buf_write(&buf, "ng %s %s\n", |
| 2549 | cmd->ref_name, cmd->error_string); |
| 2550 | } |
| 2551 | packet_buf_flush(&buf); |
| 2552 | |
| 2553 | if (use_sideband) |
| 2554 | send_sideband(1, 1, buf.buf, buf.len, use_sideband); |
| 2555 | else |
| 2556 | write_or_die(1, buf.buf, buf.len); |
| 2557 | strbuf_release(&buf); |
| 2558 | } |
| 2559 | |
| 2560 | static void report_v2(struct command *commands, const char *unpack_status) |
| 2561 | { |
no test coverage detected