summaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2010-09-20 02:28:53 -0600
committerJunio C Hamano <gitster@pobox.com>2010-09-29 17:32:38 -0700
commit25c3936349ba052f0c7e9ba3ce138b89abcae6ee (patch)
treecad69035537f824eaa339ad86478fde14986e27c /merge-recursive.c
parent0c4918d1c1722c1faaa909f3f8486d5a0d816538 (diff)
downloadgit-25c3936349ba052f0c7e9ba3ce138b89abcae6ee.tar.gz
merge-recursive: New data structures for deferring of D/F conflicts
Since we need to resolve paths (including renames) in-core first and defer checking of D/F conflicts (namely waiting to see if directories are still in the way after all paths are resolved) before updating files involved in D/F conflicts, we will need to first process_renames, then record some information about the rename needed at D/F resolution time, and then make use of that information when resolving D/F conflicts at the end. This commit adds some relevant data structures for storing the necessary information. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index 9c415c8e5a..6ea4e3d2db 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -63,6 +63,22 @@ static int sha_eq(const unsigned char *a, const unsigned char *b)
return a && b && hashcmp(a, b) == 0;
}
+enum rename_type {
+ RENAME_NORMAL = 0,
+ RENAME_DELETE,
+ RENAME_ONE_FILE_TO_TWO
+};
+
+struct rename_df_conflict_info {
+ enum rename_type rename_type;
+ struct diff_filepair *pair1;
+ struct diff_filepair *pair2;
+ const char *branch1;
+ const char *branch2;
+ struct stage_data *dst_entry1;
+ struct stage_data *dst_entry2;
+};
+
/*
* Since we want to write the index eventually, we cannot reuse the index
* for these (temporary) data.
@@ -74,9 +90,37 @@ struct stage_data
unsigned mode;
unsigned char sha[20];
} stages[4];
+ struct rename_df_conflict_info *rename_df_conflict_info;
unsigned processed:1;
};
+static inline void setup_rename_df_conflict_info(enum rename_type rename_type,
+ struct diff_filepair *pair1,
+ struct diff_filepair *pair2,
+ const char *branch1,
+ const char *branch2,
+ struct stage_data *dst_entry1,
+ struct stage_data *dst_entry2)
+{
+ struct rename_df_conflict_info *ci = xcalloc(1, sizeof(struct rename_df_conflict_info));
+ ci->rename_type = rename_type;
+ ci->pair1 = pair1;
+ ci->branch1 = branch1;
+ ci->branch2 = branch2;
+
+ ci->dst_entry1 = dst_entry1;
+ dst_entry1->rename_df_conflict_info = ci;
+ dst_entry1->processed = 0;
+
+ assert(!pair2 == !dst_entry2);
+ if (dst_entry2) {
+ ci->dst_entry2 = dst_entry2;
+ ci->pair2 = pair2;
+ dst_entry2->rename_df_conflict_info = ci;
+ dst_entry2->processed = 0;
+ }
+}
+
static int show(struct merge_options *o, int v)
{
return (!o->call_depth && o->verbosity >= v) || o->verbosity >= 5;