diff options
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | 2008-02-17 19:07:19 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-02-18 00:08:40 -0800 |
commit | f407f14deaa14ebddd0d27238523ced8eca74393 (patch) | |
tree | 6250028e000ffb0bdb2b0096aec7f0aa45130601 /t | |
parent | cf5c51efc9fe3b0ef93c7b78005c57b71acaf959 (diff) | |
download | git-f407f14deaa14ebddd0d27238523ced8eca74393.tar.gz git-f407f14deaa14ebddd0d27238523ced8eca74393.tar.xz |
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>
Diffstat (limited to 't')
-rwxr-xr-x | t/t6023-merge-file.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh index 86419964b..869e8d559 100755 --- a/t/t6023-merge-file.sh +++ b/t/t6023-merge-file.sh @@ -139,4 +139,14 @@ test_expect_success 'binary files cannot be merged' ' grep "Cannot merge binary files" merge.err ' +sed -e "s/deerit.$/deerit;/" -e "s/me;$/me./" < new5.txt > new6.txt +sed -e "s/deerit.$/deerit,/" -e "s/me;$/me,/" < new5.txt > new7.txt + +test_expect_success 'MERGE_ZEALOUS simplifies non-conflicts' ' + + ! git merge-file -p new6.txt new5.txt new7.txt > output && + test 1 = $(grep ======= < output | wc -l) + +' + test_done |