combine-diff: coalesce lost lines optimally
commit99d3206010ba1fcc9311cbe8376c0b5e78f4a136
authorAntoine Pelisse <apelisse@gmail.com>
Sat, 23 Mar 2013 17:23:28 +0000 (23 18:23 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 Mar 2013 21:52:33 +0000 (25 14:52 -0700)
treedf1827a997f3f16a8f8e3ab1ea47eb25db79c176
parentfa04ae0be8cca1291a60bc8a393f9c52d2582089
combine-diff: coalesce lost lines optimally

This replaces the greedy implementation to coalesce lost lines by using
dynamic programming to find the Longest Common Subsequence.

The O(n²) time complexity is obviously bigger than previous
implementation but it can produce shorter diff results (and most likely
easier to read).

List of lost lines is now doubly-linked because we reverse-read it when
reading the direction matrix.

Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
combine-diff.c
t/t4038-diff-combined.sh