Merge branch 'en/merge-ort-impl'
[git] / merge-ort.h
1 #ifndef MERGE_ORT_H
2 #define MERGE_ORT_H
3
4 #include "merge-recursive.h"
5
6 struct commit;
7 struct tree;
8
9 struct merge_result {
10         /*
11          * Whether the merge is clean; possible values:
12          *    1: clean
13          *    0: not clean (merge conflicts)
14          *   <0: operation aborted prematurely.  (object database
15          *       unreadable, disk full, etc.)  Worktree may be left in an
16          *       inconsistent state if operation failed near the end.
17          */
18         int clean;
19
20         /*
21          * Result of merge.  If !clean, represents what would go in worktree
22          * (thus possibly including files containing conflict markers).
23          */
24         struct tree *tree;
25
26         /*
27          * Additional metadata used by merge_switch_to_result() or future calls
28          * to merge_incore_*().  Includes data needed to update the index (if
29          * !clean) and to print "CONFLICT" messages.  Not for external use.
30          */
31         void *priv;
32 };
33
34 /*
35  * rename-detecting three-way merge with recursive ancestor consolidation.
36  * working tree and index are untouched.
37  */
38 void merge_incore_recursive(struct merge_options *opt,
39                             struct commit_list *merge_bases,
40                             struct commit *side1,
41                             struct commit *side2,
42                             struct merge_result *result);
43
44 /*
45  * rename-detecting three-way merge, no recursion.
46  * working tree and index are untouched.
47  */
48 void merge_incore_nonrecursive(struct merge_options *opt,
49                                struct tree *merge_base,
50                                struct tree *side1,
51                                struct tree *side2,
52                                struct merge_result *result);
53
54 /* Update the working tree and index from head to result after incore merge */
55 void merge_switch_to_result(struct merge_options *opt,
56                             struct tree *head,
57                             struct merge_result *result,
58                             int update_worktree_and_index,
59                             int display_update_msgs);
60
61 /* Do needed cleanup when not calling merge_switch_to_result() */
62 void merge_finalize(struct merge_options *opt,
63                     struct merge_result *result);
64
65 #endif