| 1486 | #define SUMMARY_HEADER_WIDTH 20 |
| 1487 | #define SUMMARY_LINE_WIDTH 80 |
| 1488 | static void summarize_hunk(struct add_p_state *s, struct hunk *hunk, |
| 1489 | struct strbuf *out) |
| 1490 | { |
| 1491 | struct hunk_header *header = &hunk->header; |
| 1492 | struct strbuf *plain = &s->plain; |
| 1493 | size_t len = out->len, i; |
| 1494 | |
| 1495 | strbuf_addf(out, " -%lu,%lu +%lu,%lu ", |
| 1496 | header->old_offset, header->old_count, |
| 1497 | header->new_offset, header->new_count); |
| 1498 | if (out->len - len < SUMMARY_HEADER_WIDTH) |
| 1499 | strbuf_addchars(out, ' ', |
| 1500 | SUMMARY_HEADER_WIDTH + len - out->len); |
| 1501 | for (i = hunk->start; i < hunk->end; i = find_next_line(plain, i)) |
| 1502 | if (plain->buf[i] != ' ') |
| 1503 | break; |
| 1504 | if (i < hunk->end) |
| 1505 | strbuf_add(out, plain->buf + i, find_next_line(plain, i) - i); |
| 1506 | if (out->len - len > SUMMARY_LINE_WIDTH) |
| 1507 | strbuf_setlen(out, len + SUMMARY_LINE_WIDTH); |
| 1508 | strbuf_complete_line(out); |
| 1509 | } |
| 1510 | |
| 1511 | #define DISPLAY_HUNKS_LINES 20 |
| 1512 | static size_t display_hunks(struct add_p_state *s, |
no test coverage detected