Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--merge-ort.c52
-rw-r--r--merge-ort.h58
3 files changed, 111 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 1fb0ec1705..bb9181e3af 100644
--- a/Makefile
+++ b/Makefile
@@ -921,6 +921,7 @@ LIB_OBJS += mailmap.o
LIB_OBJS += match-trees.o
LIB_OBJS += mem-pool.o
LIB_OBJS += merge-blobs.o
+LIB_OBJS += merge-ort.o
LIB_OBJS += merge-recursive.o
LIB_OBJS += merge.o
LIB_OBJS += mergesort.o
diff --git a/merge-ort.c b/merge-ort.c
new file mode 100644
index 0000000000..b487901d3e
--- /dev/null
+++ b/merge-ort.c
@@ -0,0 +1,52 @@
+/*
+ * "Ostensibly Recursive's Twin" merge strategy, or "ort" for short. Meant
+ * as a drop-in replacement for the "recursive" merge strategy, allowing one
+ * to replace
+ *
+ * git merge [-s recursive]
+ *
+ * with
+ *
+ * git merge -s ort
+ *
+ * Note: git's parser allows the space between '-s' and its argument to be
+ * missing. (Should I have backronymed "ham", "alsa", "kip", "nap, "alvo",
+ * "cale", "peedy", or "ins" instead of "ort"?)
+ */
+
+#include "cache.h"
+#include "merge-ort.h"
+
+void merge_switch_to_result(struct merge_options *opt,
+ struct tree *head,
+ struct merge_result *result,
+ int update_worktree_and_index,
+ int display_update_msgs)
+{
+ die("Not yet implemented");
+ merge_finalize(opt, result);
+}
+
+void merge_finalize(struct merge_options *opt,
+ struct merge_result *result)
+{
+ die("Not yet implemented");
+}
+
+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");
+}
+
+void merge_incore_recursive(struct merge_options *opt,
+ struct commit_list *merge_bases,
+ struct commit *side1,
+ struct commit *side2,
+ struct merge_result *result)
+{
+ die("Not yet implemented");
+}
diff --git a/merge-ort.h b/merge-ort.h
new file mode 100644
index 0000000000..74adccad16
--- /dev/null
+++ b/merge-ort.h
@@ -0,0 +1,58 @@
+#ifndef MERGE_ORT_H
+#define MERGE_ORT_H
+
+#include "merge-recursive.h"
+
+struct commit;
+struct tree;
+
+struct merge_result {
+ /* Whether the merge is clean */
+ int clean;
+
+ /*
+ * Result of merge. If !clean, represents what would go in worktree
+ * (thus possibly including files containing conflict markers).
+ */
+ struct tree *tree;
+
+ /*
+ * Additional metadata used by merge_switch_to_result() or future calls
+ * to merge_incore_*(). Includes data needed to update the index (if
+ * !clean) and to print "CONFLICT" messages. Not for external use.
+ */
+ void *priv;
+};
+
+/*
+ * rename-detecting three-way merge with recursive ancestor consolidation.
+ * working tree and index are untouched.
+ */
+void merge_incore_recursive(struct merge_options *opt,
+ struct commit_list *merge_bases,
+ struct commit *side1,
+ struct commit *side2,
+ struct merge_result *result);
+
+/*
+ * rename-detecting three-way merge, no recursion.
+ * working tree and index are untouched.
+ */
+void merge_incore_nonrecursive(struct merge_options *opt,
+ struct tree *merge_base,
+ struct tree *side1,
+ struct tree *side2,
+ struct merge_result *result);
+
+/* Update the working tree and index from head to result after incore merge */
+void merge_switch_to_result(struct merge_options *opt,
+ struct tree *head,
+ struct merge_result *result,
+ int update_worktree_and_index,
+ int display_update_msgs);
+
+/* Do needed cleanup when not calling merge_switch_to_result() */
+void merge_finalize(struct merge_options *opt,
+ struct merge_result *result);
+
+#endif