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>
Elijah Newren committed
Dec 16, 2020 at 22:28 UTC
4296d8f17d45465c9712fab099a1a6787a8e9913
1 file changed
+20
merge-ort.c
+20
@@ -17,8 +17,10 @@
17
#include "cache.h"
18
#include "merge-ort.h"
19
20
+#include "alloc.h"
21
#include "blob.h"
22
#include "cache-tree.h"
23
+#include "commit.h"
24
#include "commit-reach.h"
25
#include "diff.h"
26
#include "diffcore.h"
@@ -1348,6 +1350,24 @@ void merge_finalize(struct merge_options *opt,
1350
1351
/*** Function Grouping: helper functions for merge_incore_*() ***/
1352
1353
+static inline void set_commit_tree(struct commit *c, struct tree *t)
1354
+{
1355
+ c->maybe_tree = t;
1356
+}
1357
+
1358
+MAYBE_UNUSED
1359
+static struct commit *make_virtual_commit(struct repository *repo,
1360
+ struct tree *tree,
1361
+ const char *comment)
1362
+{
1363
+ struct commit *commit = alloc_commit_node(repo);
1364
+
1365
+ set_merge_remote_desc(commit, comment, (struct object *)commit);
1366
+ set_commit_tree(commit, tree);
1367
+ commit->object.parsed = 1;
1368
+ return commit;
1369
+}
1370
+
1371
static void merge_start(struct merge_options *opt, struct merge_result *result)
1372
{
1373
/* Sanity checks on opt */