xdl_merge(): make XDL_MERGE_ZEALOUS output simpler
commitf407f14deaa14ebddd0d27238523ced8eca74393
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Sun, 17 Feb 2008 19:07:19 +0000 (17 19:07 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 18 Feb 2008 08:08:40 +0000 (18 00:08 -0800)
tree6250028e000ffb0bdb2b0096aec7f0aa45130601
parentcf5c51efc9fe3b0ef93c7b78005c57b71acaf959
xdl_merge(): make XDL_MERGE_ZEALOUS output simpler

When a merge conflicts, there are often less than three common lines
between two conflicting regions.

Since a conflict takes up as many lines as are conflicting, plus three
lines for the commit markers,  the output will be shorter (and thus,
simpler) in this case, if the common lines will be merged into the
conflicting regions.

This patch merges up to three common lines into the conflicts.

For example, what looked like this before this patch:

<<<<<<<
if (a == 1)
=======
if (a != 0)
>>>>>>>
{
int i;
<<<<<<<
a = 0;
=======
a = !a;
>>>>>>>

will now look like this:

<<<<<<<
if (a == 1)
{
int i;
a = 0;
=======
if (a != 0)
{
int i;
a = !a;
>>>>>>>

Suggested Linus (based on ideas by "Voltage Spike" -- if that name is
real, it is mighty cool).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6023-merge-file.sh
xdiff/xmerge.c