summaryrefslogtreecommitdiff
path: root/xdiff-interface.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-12-16 21:49:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-12-16 22:00:30 (GMT)
commit079fe1dae8504c988c50ce41eba78743d3f588e0 (patch)
tree540262f8d88313124fb3faef6c57ad652e791491 /xdiff-interface.c
parent127f72e6897d6671725dc13db42ab5ee1d086721 (diff)
downloadgit-079fe1dae8504c988c50ce41eba78743d3f588e0.zip
git-079fe1dae8504c988c50ce41eba78743d3f588e0.tar.gz
git-079fe1dae8504c988c50ce41eba78743d3f588e0.tar.bz2
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>
Diffstat (limited to 'xdiff-interface.c')
-rw-r--r--xdiff-interface.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/xdiff-interface.c b/xdiff-interface.c
index 98b02ed..9ee877c 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);