]> git.ipfire.org Git - thirdparty/git.git/blob - merge-ort.h
clone: allow "--bare" with "-o"
[thirdparty/git.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 struct strmap;
9
10 struct merge_result {
11 /*
12 * Whether the merge is clean; possible values:
13 * 1: clean
14 * 0: not clean (merge conflicts)
15 * <0: operation aborted prematurely. (object database
16 * unreadable, disk full, etc.) Worktree may be left in an
17 * inconsistent state if operation failed near the end.
18 */
19 int clean;
20
21 /*
22 * Result of merge. If !clean, represents what would go in worktree
23 * (thus possibly including files containing conflict markers).
24 */
25 struct tree *tree;
26
27 /*
28 * Special messages and conflict notices for various paths
29 *
30 * This is a map of pathnames to strbufs. It contains various
31 * warning/conflict/notice messages (possibly multiple per path)
32 * that callers may want to use.
33 */
34 struct strmap *path_messages;
35
36 /*
37 * Additional metadata used by merge_switch_to_result() or future calls
38 * to merge_incore_*(). Includes data needed to update the index (if
39 * !clean) and to print "CONFLICT" messages. Not for external use.
40 */
41 void *priv;
42 /* Also private */
43 unsigned _properly_initialized;
44 };
45
46 /*
47 * rename-detecting three-way merge with recursive ancestor consolidation.
48 * working tree and index are untouched.
49 *
50 * merge_bases will be consumed (emptied) so make a copy if you need it.
51 *
52 * NOTE: empirically, the recursive algorithm will perform better if you
53 * pass the merge_bases in the order of oldest commit to the
54 * newest[1][2].
55 *
56 * [1] https://lore.kernel.org/git/nycvar.QRO.7.76.6.1907252055500.21907@tvgsbejvaqbjf.bet/
57 * [2] commit 8918b0c9c2 ("merge-recur: try to merge older merge bases
58 * first", 2006-08-09)
59 */
60 void merge_incore_recursive(struct merge_options *opt,
61 struct commit_list *merge_bases,
62 struct commit *side1,
63 struct commit *side2,
64 struct merge_result *result);
65
66 /*
67 * rename-detecting three-way merge, no recursion.
68 * working tree and index are untouched.
69 */
70 void merge_incore_nonrecursive(struct merge_options *opt,
71 struct tree *merge_base,
72 struct tree *side1,
73 struct tree *side2,
74 struct merge_result *result);
75
76 /* Update the working tree and index from head to result after incore merge */
77 void merge_switch_to_result(struct merge_options *opt,
78 struct tree *head,
79 struct merge_result *result,
80 int update_worktree_and_index,
81 int display_update_msgs);
82
83 /* Do needed cleanup when not calling merge_switch_to_result() */
84 void merge_finalize(struct merge_options *opt,
85 struct merge_result *result);
86
87 #endif