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

Function parse_fragment_header

apply.c:1566–1578  ·  view source on GitHub ↗

* Parse a unified diff fragment header of the * form "@@ -a,b +c,d @@" */

Source from the content-addressed store, hash-verified

1564 * form "@@ -a,b +c,d @@"
1565 */
1566static int parse_fragment_header(const char *line, int len, struct fragment *fragment)
1567{
1568 int offset;
1569
1570 if (!len || line[len-1] != '\n')
1571 return -1;
1572
1573 /* Figure out the number of lines in a fragment */
1574 offset = parse_range(line, len, 4, " +", &fragment->oldpos, &fragment->oldlines);
1575 offset = parse_range(line, len, offset, " @@", &fragment->newpos, &fragment->newlines);
1576
1577 return offset;
1578}
1579
1580/*
1581 * Find file diff header

Callers 2

find_headerFunction · 0.85
parse_fragmentFunction · 0.85

Calls 1

parse_rangeFunction · 0.70

Tested by

no test coverage detected