From 079fe1dae8504c988c50ce41eba78743d3f588e0 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 16 Dec 2007 13:49:17 -0800 Subject: 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 --- xdiff-interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xdiff-interface.c') diff --git a/xdiff-interface.c b/xdiff-interface.c index 98b02eda35..9ee877c6f4 100644 --- a/xdiff-interface.c +++ b/xdiff-interface.c @@ -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); -- cgit v1.2.1