MCPcopy Create free account
hub / github.com/git/git / display_hunks

Function display_hunks

add-patch.c:1512–1532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1510
1511#define DISPLAY_HUNKS_LINES 20
1512static size_t display_hunks(struct add_p_state *s,
1513 struct file_diff *file_diff, size_t start_index)
1514{
1515 size_t end_index = start_index + DISPLAY_HUNKS_LINES;
1516
1517 if (end_index > file_diff->hunk_nr)
1518 end_index = file_diff->hunk_nr;
1519
1520 while (start_index < end_index) {
1521 struct hunk *hunk = file_diff->hunk + start_index++;
1522
1523 strbuf_reset(&s->buf);
1524 strbuf_addf(&s->buf, "%c%2d: ", hunk->use == USE_HUNK ? '+'
1525 : hunk->use == SKIP_HUNK ? '-' : ' ',
1526 (int)start_index);
1527 summarize_hunk(s, hunk, &s->buf);
1528 fputs(s->buf.buf, stdout);
1529 }
1530
1531 return end_index;
1532}
1533
1534static const char help_patch_remainder[] =
1535N_("j - go to the next undecided hunk, roll over at the bottom\n"

Callers 1

patch_update_fileFunction · 0.85

Calls 2

strbuf_addfFunction · 0.85
summarize_hunkFunction · 0.85

Tested by

no test coverage detected