@@ -18,6 +18,7 @@
#include "merge-ort.h"
#include "strmap.h"
+#include "tree.h"
struct merge_options_internal {
/*
@@ -164,6 +165,38 @@ struct conflict_info {
unsigned match_mask:3;
};
+static int collect_merge_info(struct merge_options *opt,
+ struct tree *merge_base,
+ struct tree *side1,
+ struct tree *side2)
+{
+ /* TODO: Implement this using traverse_trees() */
+ die("Not yet implemented.");
+}
+
+static int detect_and_process_renames(struct merge_options *opt,
+ struct tree *merge_base,
+ struct tree *side1,
+ struct tree *side2)
+{
+ int clean = 1;
+
+ /*
+ * Rename detection works by detecting file similarity. Here we use
+ * a really easy-to-implement scheme: files are similar IFF they have
+ * the same filename. Therefore, by this scheme, there are no renames.
+ *
+ * TODO: Actually implement a real rename detection scheme.
+ */
+ return clean;
+}
+
+static void process_entries(struct merge_options *opt,
+ struct object_id *result_oid)
+{
+ die("Not yet implemented.");
+}
+
void merge_switch_to_result(struct merge_options *opt,
struct tree *head,
struct merge_result *result,
@@ -180,13 +213,46 @@ void merge_finalize(struct merge_options *opt,
die("Not yet implemented");
}
+static void merge_start(struct merge_options *opt, struct merge_result *result)
+{
+ die("Not yet implemented.");
+}
+
+/*
+ * Originally from merge_trees_internal(); heavily adapted, though.
+ */
+static void merge_ort_nonrecursive_internal(struct merge_options *opt,
+ struct tree *merge_base,
+ struct tree *side1,
+ struct tree *side2,
+ struct merge_result *result)
+{
+ struct object_id working_tree_oid;
+
+ collect_merge_info(opt, merge_base, side1, side2);
+ result->clean = detect_and_process_renames(opt, merge_base,
+ side1, side2);
+ process_entries(opt, &working_tree_oid);
+
+ /* Set return values */
+ result->tree = parse_tree_indirect(&working_tree_oid);
+ /* existence of conflicted entries implies unclean */
+ result->clean &= strmap_empty(&opt->priv->conflicted);
+ if (!opt->priv->call_depth) {
+ result->priv = opt->priv;
+ opt->priv = NULL;
+ }
+}
+
void merge_incore_nonrecursive(struct merge_options *opt,
struct tree *merge_base,
struct tree *side1,
struct tree *side2,
struct merge_result *result)
{
- die("Not yet implemented");
+ assert(opt->ancestor != NULL);
+ merge_start(opt, result);
+ merge_ort_nonrecursive_internal(opt, merge_base, side1, side2, result);
}
void merge_incore_recursive(struct merge_options *opt,