Skip to content

Commit 4296d8f

Browse files
newrengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b0ca120 commit 4296d8f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

merge-ort.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
#include "cache.h"
1818
#include "merge-ort.h"
1919

20+
#include "alloc.h"
2021
#include "blob.h"
2122
#include "cache-tree.h"
23+
#include "commit.h"
2224
#include "commit-reach.h"
2325
#include "diff.h"
2426
#include "diffcore.h"
@@ -1348,6 +1350,24 @@ void merge_finalize(struct merge_options *opt,
13481350

13491351
/*** Function Grouping: helper functions for merge_incore_*() ***/
13501352

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+
13511371
static void merge_start(struct merge_options *opt, struct merge_result *result)
13521372
{
13531373
/* Sanity checks on opt */

0 commit comments

Comments
 (0)