summaryrefslogtreecommitdiff
path: root/merge-ort.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2020-12-16 22:28:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-12-17 05:56:39 (GMT)
commit4296d8f17d45465c9712fab099a1a6787a8e9913 (patch)
tree4249eb4ebb468246cfba73153ca2242c822f841a /merge-ort.c
parentb0ca120554be8d8f7faf98aa3b991441de76f5cf (diff)
downloadgit-4296d8f17d45465c9712fab099a1a6787a8e9913.zip
git-4296d8f17d45465c9712fab099a1a6787a8e9913.tar.gz
git-4296d8f17d45465c9712fab099a1a6787a8e9913.tar.bz2
merge-ort: copy a few small helper functions from merge-recursive.c
In a subsequent commit, we will implement the traditional recursiveness that gave merge-recursive its name, namely merging non-unique merge-bases to come up with a single virtual merge base. Copy a few helper functions from merge-recursive.c that we will use in the implementation. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-ort.c')
-rw-r--r--merge-ort.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/merge-ort.c b/merge-ort.c
index 414e7b7..6eac0ce 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -17,8 +17,10 @@
#include "cache.h"
#include "merge-ort.h"
+#include "alloc.h"
#include "blob.h"
#include "cache-tree.h"
+#include "commit.h"
#include "commit-reach.h"
#include "diff.h"
#include "diffcore.h"
@@ -1348,6 +1350,24 @@ void merge_finalize(struct merge_options *opt,
/*** Function Grouping: helper functions for merge_incore_*() ***/
+static inline void set_commit_tree(struct commit *c, struct tree *t)
+{
+ c->maybe_tree = t;
+}
+
+MAYBE_UNUSED
+static struct commit *make_virtual_commit(struct repository *repo,
+ struct tree *tree,
+ const char *comment)
+{
+ struct commit *commit = alloc_commit_node(repo);
+
+ set_merge_remote_desc(commit, comment, (struct object *)commit);
+ set_commit_tree(commit, tree);
+ commit->object.parsed = 1;
+ return commit;
+}
+
static void merge_start(struct merge_options *opt, struct merge_result *result)
{
/* Sanity checks on opt */