1 module deimos.git2.merge;
2 
3 import deimos.git2.common;
4 import deimos.git2.checkout;
5 import deimos.git2.diff;
6 import deimos.git2.index;
7 import deimos.git2.oid;
8 import deimos.git2.util;
9 import deimos.git2.types;
10 
11 extern (C):
12 
13 enum git_merge_tree_flag_t {
14 	GIT_MERGE_TREE_FIND_RENAMES = (1 << 0),
15 }
16 mixin _ExportEnumMembers!git_merge_tree_flag_t;
17 
18 enum git_merge_automerge_flags {
19 	GIT_MERGE_AUTOMERGE_NORMAL = 0,
20 	GIT_MERGE_AUTOMERGE_NONE = 1,
21 	GIT_MERGE_AUTOMERGE_FAVOR_OURS = 2,
22 	GIT_MERGE_AUTOMERGE_FAVOR_THEIRS = 3,
23 }
24 mixin _ExportEnumMembers!git_merge_automerge_flags;
25 
26 struct git_merge_tree_opts {
27 	uint version_ = GIT_MERGE_TREE_OPTS_VERSION;
28 	git_merge_tree_flag_t flags;
29 	uint rename_threshold;
30 	uint target_limit;
31 	git_diff_similarity_metric *metric;
32 	git_merge_automerge_flags automerge_flags;
33 }
34 
35 enum GIT_MERGE_TREE_OPTS_VERSION = 1;
36 enum git_merge_tree_opts GIT_MERGE_TREE_OPTS_INIT = { GIT_MERGE_TREE_OPTS_VERSION };
37 
38 enum git_merge_flags_t {
39 	GIT_MERGE_NO_FASTFORWARD      = 1,
40 	GIT_MERGE_FASTFORWARD_ONLY    = 2,
41 }
42 
43 struct git_merge_opts {
44 	uint version_ = GIT_MERGE_OPTS_VERSION;
45 
46 	git_merge_flags_t merge_flags;
47 	git_merge_tree_opts merge_tree_opts;
48 
49 	git_checkout_opts checkout_opts;
50 }
51 
52 enum GIT_MERGE_OPTS_VERSION = 1;
53 enum git_merge_opts GIT_MERGE_OPTS_INIT = {GIT_MERGE_OPTS_VERSION, cast(git_merge_flags_t)0, GIT_MERGE_TREE_OPTS_INIT, GIT_CHECKOUT_OPTS_INIT};
54 
55 int git_merge_base(
56 	git_oid *out_,
57 	git_repository *repo,
58 	const(git_oid)* one,
59 	const(git_oid)* two);
60 int git_merge_base_many(
61 	git_oid *out_,
62 	git_repository *repo,
63 	size_t length,
64 	const(git_oid)* input_array);
65 int git_merge_head_from_ref(
66 	git_merge_head **out_,
67 	git_repository *repo,
68 	git_reference *ref_);
69 int git_merge_head_from_fetchhead(
70 	git_merge_head **out_,
71 	git_repository *repo,
72 	const(char)* branch_name,
73 	const(char)* remote_url,
74 	const(git_oid)* oid);
75 int git_merge_head_from_oid(
76 	git_merge_head **out_,
77 	git_repository *repo,
78 	const(git_oid)* oid);
79 void git_merge_head_free(
80 	git_merge_head *head);
81 int git_merge_trees(
82 	git_index **out_,
83 	git_repository *repo,
84 	const(git_tree)* ancestor_tree,
85 	const(git_tree)* our_tree,
86 	const(git_tree)* their_tree,
87 	const(git_merge_tree_opts)* opts);
88 int git_merge(
89 	git_merge_result **out_,
90 	git_repository *repo,
91 	const(git_merge_head)* *their_heads,
92 	size_t their_heads_len,
93 	const(git_merge_opts)* opts);
94 int git_merge_result_is_uptodate(git_merge_result *merge_result);
95 int git_merge_result_is_fastforward(git_merge_result *merge_result);
96 int git_merge_result_fastforward_oid(git_oid *out_, git_merge_result *merge_result);
97 void git_merge_result_free(git_merge_result *merge_result);