Re-re-re-fix common tail optimization
We need to be extra careful recovering the removed common section, so that we do not break context nor the changed incomplete line (i.e. the last line that does not end with LF). Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@ -121,7 +121,7 @@ static void trim_common_tail(mmfile_t *a, mmfile_t *b, long ctx)
|
||||
bp -= blk;
|
||||
}
|
||||
|
||||
while (recovered < trimmed && ctx)
|
||||
while (recovered < trimmed && 0 <= ctx)
|
||||
if (ap[recovered++] == '\n')
|
||||
ctx--;
|
||||
a->size -= (trimmed - recovered);
|
||||
|
||||
Reference in New Issue
Block a user