Skip to content

Commit

Permalink
Merge branch 'remove-redundant-test-merges'
Browse files Browse the repository at this point in the history
Graham Gyatt <ggyatt@apple.com> reported a failure that was apparently
caused by executing the same test merge twice with inconsistent
answers.

This merges in a few changes that avoid the problem by not repeating
test merges redundantly, and thus never getting inconsistent answers.
  • Loading branch information
mhagger committed Mar 1, 2014
2 parents fc1915b + 4540d8f commit 0938bc0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions git-imerge
Expand Up @@ -895,7 +895,7 @@ class MergeFrontier(object):
i1 = 1
i2 = find_first_false(
lambda i: block.is_mergeable(i1, i),
1, block.len2,
2, block.len2,
)

# Now we know that (1,i2-1) is mergeable but (1,i2) is not;
Expand Down Expand Up @@ -939,9 +939,11 @@ class MergeFrontier(object):
# recorded explicitly). It also implies that a mergeable
# block has its last mergeable commit somewhere in row
# i2-1; find its width.
if block.is_mergeable(block.len1 - 1, i2 - 1):
i1 = block.len1
blocks.append(block[:i1,:i2])
if (
i1 == block.len1 - 1
or block.is_mergeable(block.len1 - 1, i2 - 1)
):
blocks.append(block[:block.len1,:i2])
break
else:
i1 = find_first_false(
Expand All @@ -966,13 +968,13 @@ class MergeFrontier(object):
# The block ending at (i1-1,i2-1) has just been recorded.
# Now find the height of the conflict rectangle at column
# i1 and fill it in:
if block.is_mergeable(i1, 1):
if i2 - 1 == 1 or not block.is_mergeable(i1, 1):
break
else:
i2 = find_first_false(
lambda i: block.is_mergeable(i1, i),
2, i2 - 1,
)
else:
break

return MergeFrontier(block, blocks)

Expand Down

0 comments on commit 0938bc0

Please sign in to comment.