MCPcopy Index your code
hub / github.com/git/git / adjust_incomplete

Function adjust_incomplete

apply.c:1739–1752  ·  view source on GitHub ↗

* Just saw a single line in a fragment. If it is a part of this hunk * that is a context " ", an added "+", or a removed "-" line, it may * be followed by "\\ No newline..." to signal that the last "\n" on * this line needs to be dropped. Depending on locale settings when * the patch was produced we don't know what this line would exactly * say. The only thing we do know is that it begins w

Source from the content-addressed store, hash-verified

1737 * "\ No newline..." line.
1738 */
1739static int adjust_incomplete(const char *line, int len,
1740 unsigned long size)
1741{
1742 int nextlen;
1743
1744 if (*line != '\n' && *line != ' ' && *line != '+' && *line != '-')
1745 return 0;
1746 if (size - len < 12 || memcmp(line + len, "\\ ", 2))
1747 return 0;
1748 nextlen = linelen(line + len, size - len);
1749 if (nextlen < 12)
1750 return 0;
1751 return nextlen;
1752}
1753
1754/*
1755 * Parse a unified diff. Note that this really needs to parse each

Callers 1

parse_fragmentFunction · 0.85

Calls 1

linelenFunction · 0.70

Tested by

no test coverage detected