Skip to content

Commit

Permalink
MergeFrontier.compute_by_bisection(): Avoid redundant test merge.
Browse files Browse the repository at this point in the history
If i2 - 1 is in row 1, then there is no reason to do a test merge in
row 1 *again*.

The redundant testing could have probably caused bugs like the one
described in the last commit.
  • Loading branch information
mhagger committed Mar 1, 2014
1 parent e0504ec commit 4540d8f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions git-imerge
Original file line number Diff line number Diff line change
Expand Up @@ -968,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 4540d8f

Please sign in to comment.