Brandon Casey wrote:
On Mon, Jan 21, 2013 at 11:54 PM, Jonathan Nieder [off-list ref] wrote:
quoted
First (snipped), it seeks back two newlines from the end and then
forward to the next non-newline character, so (buf + i) is at the
start of the last line of (the interesting part of) sb.
Did you catch that the two newlines have to be adjacent to each other?
[...]
Here is the loop in master:
int hit = 0;
[...]
for (i = len - 1; i > 0; i--) {
if (hit && buf[i] == '\n')
break;
hit = (buf[i] == '\n');
}
I don't see any adjacency check. I agree with you that "two adjacent
newlines" was probably the intent, though.