From 55dcc17c331f580b3beeb4d5decf64d3baf94f2e Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 24 Jun 2010 16:02:28 +0200 Subject: aggressive_tree_merge: fixed incorrect handling of one branch, it was just not implemented causing incorrect merge results. Added test to cover this issue Diff: added NULL_BIN_SHA constant for completeness --- lib/git/index/fun.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib/git/index/fun.py') diff --git a/lib/git/index/fun.py b/lib/git/index/fun.py index 23a6d8f9..14a47fdc 100644 --- a/lib/git/index/fun.py +++ b/lib/git/index/fun.py @@ -283,7 +283,16 @@ def aggressive_tree_merge(odb, tree_shas): elif theirs is None: # added in our branch out_append(_tree_entry_to_baseindexentry(ours, 0)) - # END hanle heads + else: + # both have it, except for the base, see whether it changed + if ours[0] != theirs[0] or ours[1] != theirs[1]: + out_append(_tree_entry_to_baseindexentry(ours, 2)) + out_append(_tree_entry_to_baseindexentry(theirs, 3)) + else: + # it was added the same in both + out_append(_tree_entry_to_baseindexentry(ours, 0)) + # END handle two items + # END handle heads # END handle base exists # END for each entries tuple -- cgit v1.2.1