4 #include "merge-recursive.h"
13 * Whether the merge is clean; possible values:
15 * 0: not clean (merge conflicts)
16 * <0: operation aborted prematurely. (object database
17 * unreadable, disk full, etc.) Worktree may be left in an
18 * inconsistent state if operation failed near the end.
23 * Result of merge. If !clean, represents what would go in worktree
24 * (thus possibly including files containing conflict markers).
29 * Special messages and conflict notices for various paths
31 * This is a map of pathnames to a string_list. It contains various
32 * warning/conflict/notice messages (possibly multiple per path)
33 * that callers may want to use.
35 struct strmap
*path_messages
;
38 * Additional metadata used by merge_switch_to_result() or future calls
39 * to merge_incore_*(). Includes data needed to update the index (if
40 * !clean) and to print "CONFLICT" messages. Not for external use.
44 unsigned _properly_initialized
;
48 * rename-detecting three-way merge with recursive ancestor consolidation.
49 * working tree and index are untouched.
51 * merge_bases will be consumed (emptied) so make a copy if you need it.
53 * NOTE: empirically, the recursive algorithm will perform better if you
54 * pass the merge_bases in the order of oldest commit to the
57 * [1] https://lore.kernel.org/git/nycvar.QRO.7.76.6.1907252055500.21907@tvgsbejvaqbjf.bet/
58 * [2] commit 8918b0c9c2 ("merge-recur: try to merge older merge bases
61 void merge_incore_recursive(struct merge_options
*opt
,
62 const struct commit_list
*merge_bases
,
65 struct merge_result
*result
);
68 * rename-detecting three-way merge, no recursion.
69 * working tree and index are untouched.
71 void merge_incore_nonrecursive(struct merge_options
*opt
,
72 struct tree
*merge_base
,
75 struct merge_result
*result
);
77 /* Update the working tree and index from head to result after incore merge */
78 void merge_switch_to_result(struct merge_options
*opt
,
80 struct merge_result
*result
,
81 int update_worktree_and_index
,
82 int display_update_msgs
);
85 * Display messages about conflicts and which files were 3-way merged.
86 * Automatically called by merge_switch_to_result() with stream == stdout,
87 * so only call this when bypassing merge_switch_to_result().
89 void merge_display_update_messages(struct merge_options
*opt
,
91 struct merge_result
*result
);
100 * Provide a list of path -> {struct stage_info*} mappings for
101 * all conflicted files. Note that each path could appear up to three
102 * times in the list, corresponding to 3 different stage entries. In short,
103 * this basically provides the info that would be printed by `ls-files -u`.
105 * result should have been populated by a call to
106 * one of the merge_incore_[non]recursive() functions.
108 * conflicted_files should be empty before calling this function.
110 void merge_get_conflicted_files(struct merge_result
*result
,
111 struct string_list
*conflicted_files
);
113 /* Do needed cleanup when not calling merge_switch_to_result() */
114 void merge_finalize(struct merge_options
*opt
,
115 struct merge_result
*result
);