Aggressive three-way merge: fix D/F case
When the ancestor used to have a blob "P", your tree removed it, and the tree you are merging with also removed it, the agressive three-way cleanly merges to remove that blob. If the other tree added a new blob "P/Q" while removing "P", it should also merge cleanly to remove "P" and create "P/Q" (since neither the ancestor nor your tree could have had it, so it is a typical "created in one"). The "aggressive" rule is not new anymore. Reword the stale comment. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Oct 11, 2009 at 13:38 UTC
cee2d6ae6379e7c76e602d55ccc1d4babc1979c0
2 files changed
+9
-6
t/t6035-merge-dir-to-symlink.sh
+1
-1
@@ -74,7 +74,7 @@ test_expect_success 'setup a merge where dir a/b-2 changed to symlink' '
74
git tag test2
75
'
76
77
-test_expect_failure 'merge should not have conflicts (resolve)' '
77
+test_expect_success 'merge should not have conflicts (resolve)' '
78
git reset --hard &&
79
git checkout baseline^0 &&
80
git merge -s resolve test2 &&
unpack-trees.c
+8
-5
@@ -767,7 +767,8 @@ int threeway_merge(struct cache_entry **stages, struct unpack_trees_options *o)
767
remote = NULL;
768
}
769
770
- /* First, if there's a #16 situation, note that to prevent #13
770
+ /*
771
+ * First, if there's a #16 situation, note that to prevent #13
772
* and #14.
773
*/
774
if (!same(remote, head)) {
@@ -781,7 +782,8 @@ int threeway_merge(struct cache_entry **stages, struct unpack_trees_options *o)
782
}
783
}
784
784
- /* We start with cases where the index is allowed to match
785
+ /*
786
+ * We start with cases where the index is allowed to match
787
* something other than the head: #14(ALT) and #2ALT, where it
788
* is permitted to match the result instead.
789
*/
@@ -811,12 +813,13 @@ int threeway_merge(struct cache_entry **stages, struct unpack_trees_options *o)
813
if (!head && !remote && any_anc_missing)
814
return 0;
815
814
- /* Under the new "aggressive" rule, we resolve mostly trivial
816
+ /*
817
+ * Under the "aggressive" rule, we resolve mostly trivial
818
* cases that we historically had git-merge-one-file resolve.
819
*/
820
if (o->aggressive) {
818
- int head_deleted = !head && !df_conflict_head;
819
- int remote_deleted = !remote && !df_conflict_remote;
821
+ int head_deleted = !head;
822
+ int remote_deleted = !remote;
823
struct cache_entry *ce = NULL;
824
825
if (index)