diff options
author | Junio C Hamano <junkio@cox.net> | 2007-04-17 16:55:46 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-04-17 16:55:46 -0700 |
commit | 35812d830579643f898979be479b6fee5f7c7b38 (patch) | |
tree | 661e58853ae6b9541f1a63b97ad9db5a87809c8a /unpack-trees.c | |
parent | bb1faf0d5bc53b193bbe25e7425458c8eb85efa3 (diff) | |
parent | 885b98107547fe3f6d17ca0af0578e040f7600d0 (diff) | |
download | git-35812d830579643f898979be479b6fee5f7c7b38.tar.gz git-35812d830579643f898979be479b6fee5f7c7b38.tar.xz |
Merge branch 'jc/read-tree-df'
* jc/read-tree-df:
t3030: merge-recursive backend test.
merge-recursive: handle D/F conflict case more carefully.
merge-recursive: do not barf on "to be removed" entries.
Treat D/F conflict entry more carefully in unpack-trees.c::threeway_merge()
t1000: fix case table.
Diffstat (limited to 'unpack-trees.c')
-rw-r--r-- | unpack-trees.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/unpack-trees.c b/unpack-trees.c index a0b676903..513948135 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -665,7 +665,6 @@ int threeway_merge(struct cache_entry **stages, int count; int head_match = 0; int remote_match = 0; - const char *path = NULL; int df_conflict_head = 0; int df_conflict_remote = 0; @@ -675,13 +674,10 @@ int threeway_merge(struct cache_entry **stages, int i; for (i = 1; i < o->head_idx; i++) { - if (!stages[i]) + if (!stages[i] || stages[i] == o->df_conflict_entry) any_anc_missing = 1; - else { - if (!path) - path = stages[i]->name; + else no_anc_exists = 0; - } } index = stages[0]; @@ -697,13 +693,6 @@ int threeway_merge(struct cache_entry **stages, remote = NULL; } - if (!path && index) - path = index->name; - if (!path && head) - path = head->name; - if (!path && remote) - path = remote->name; - /* First, if there's a #16 situation, note that to prevent #13 * and #14. */ @@ -755,6 +744,23 @@ int threeway_merge(struct cache_entry **stages, if (o->aggressive) { int head_deleted = !head && !df_conflict_head; int remote_deleted = !remote && !df_conflict_remote; + const char *path = NULL; + + if (index) + path = index->name; + else if (head) + path = head->name; + else if (remote) + path = remote->name; + else { + for (i = 1; i < o->head_idx; i++) { + if (stages[i] && stages[i] != o->df_conflict_entry) { + path = stages[i]->name; + break; + } + } + } + /* * Deleted in both. * Deleted in one and unchanged in the other. @@ -786,11 +792,11 @@ int threeway_merge(struct cache_entry **stages, o->nontrivial_merge = 1; - /* #2, #3, #4, #6, #7, #9, #11. */ + /* #2, #3, #4, #6, #7, #9, #10, #11. */ count = 0; if (!head_match || !remote_match) { for (i = 1; i < o->head_idx; i++) { - if (stages[i]) { + if (stages[i] && stages[i] != o->df_conflict_entry) { keep_entry(stages[i], o); count++; break; |