summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-04-07 12:49:19 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-04-10 19:55:51 (GMT)
commit4c4caafc9cef1031beb46babe9adfdcc03f3cd52 (patch)
tree0a15dd43bef36ecd2c14198cbddd503fc65396d7
parentea4b52a86f6b6b8e5aef8e47fb557f37422512bf (diff)
downloadgit-4c4caafc9cef1031beb46babe9adfdcc03f3cd52.zip
git-4c4caafc9cef1031beb46babe9adfdcc03f3cd52.tar.gz
git-4c4caafc9cef1031beb46babe9adfdcc03f3cd52.tar.bz2
Treat D/F conflict entry more carefully in unpack-trees.c::threeway_merge()
This fixes three buglets in threeway_merge() regarding D/F conflict entries. * After finishing with path D and handling path D/F, some stages have D/F conflict entry which are obviously non-NULL. For the purpose of determining if the path D/F is missing in the ancestor, they should not be taken into account. * D/F conflict entry is a marker to say "this stage does _not_ have the path", so do not send them to keep_entry(). Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--unpack-trees.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index 2a58b7f..5139481 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.
@@ -790,7 +796,7 @@ int threeway_merge(struct cache_entry **stages,
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;