summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 710daa8)
raw | patch | inline | side by side (parent: 710daa8)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Tue, 5 Dec 2006 21:15:35 +0000 (22:15 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 5 Dec 2006 21:30:22 +0000 (13:30 -0800) |
Suppose you have changes in new1 to the original lines 10-20,
and changes in new2 to the original lines 15-25, then the
changes to 10-25 conflict. But it is possible that the next
changes in new1 still overlap with this change to new2.
So, in the next iteration we have to look at the same change
to new2 again.
The old code tried to be a bit too clever. The new code is
shorter and more to the point: do not fiddle with the ranges
at all.
Also, xdl_append_merge() tries harder to combine conflicts.
This is necessary, because with the above simplification,
some conflicts would not be recognized as conflicts otherwise:
In the above scenario, it is possible that there is no other
change to new1. Absent the combine logic, the change in new2
would be recorded _again_, but as a non-conflict.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
and changes in new2 to the original lines 15-25, then the
changes to 10-25 conflict. But it is possible that the next
changes in new1 still overlap with this change to new2.
So, in the next iteration we have to look at the same change
to new2 again.
The old code tried to be a bit too clever. The new code is
shorter and more to the point: do not fiddle with the ranges
at all.
Also, xdl_append_merge() tries harder to combine conflicts.
This is necessary, because with the above simplification,
some conflicts would not be recognized as conflicts otherwise:
In the above scenario, it is possible that there is no other
change to new1. Absent the combine logic, the change in new2
would be recorded _again_, but as a non-conflict.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
xdiff/xmerge.c | patch | blob | history |
diff --git a/xdiff/xmerge.c b/xdiff/xmerge.c
index 1fe7a1b060324f1382c924ba961d983b61d49c02..352207e5168135f3c6306968f03a8d191d6ac2bb 100644 (file)
--- a/xdiff/xmerge.c
+++ b/xdiff/xmerge.c
long i1, long chg1, long i2, long chg2)
{
xdmerge_t *m = *merge;
- if (m && mode == m->mode &&
- (i1 == m->i1 + m->chg1 || i2 == m->i2 + m->chg2)) {
+ if (m && (i1 <= m->i1 + m->chg1 || i2 <= m->i2 + m->chg2)) {
+ if (mode != m->mode)
+ m->mode = 0;
m->chg1 = i1 + chg1 - m->i1;
m->chg2 = i2 + chg2 - m->i2;
} else {
i1 = xscr1->i1 + xscr1->chg1;
i2 = xscr2->i1 + xscr2->chg1;
- if (i1 > i2) {
- xscr1->chg1 -= i1 - i2;
- xscr1->i1 = i2;
- xscr1->i2 += xscr1->chg2;
- xscr1->chg2 = 0;
+ if (i1 >= i2)
xscr2 = xscr2->next;
- } else if (i2 > i1) {
- xscr2->chg1 -= i2 - i1;
- xscr2->i1 = i1;
- xscr2->i2 += xscr2->chg2;
- xscr2->chg2 = 0;
- xscr1 = xscr1->next;
- } else {
+ if (i2 >= i1)
xscr1 = xscr1->next;
- xscr2 = xscr2->next;
- }
}
while (xscr1) {
if (!changes)