1 #ifndef MERGE_RECURSIVE_H
2 #define MERGE_RECURSIVE_H
4 #include "string-list.h"
5 #include "unpack-trees.h"
14 MERGE_RECURSIVE_NORMAL = 0,
16 MERGE_RECURSIVE_THEIRS
18 const char *subtree_shift;
19 unsigned buffer_output; /* 1: output at end, 2: keep buffered */
20 unsigned renormalize : 1;
23 int diff_detect_rename;
24 int merge_detect_rename;
25 int diff_rename_limit;
26 int merge_rename_limit;
28 int needed_rename_limit;
29 int show_rename_progress;
32 struct hashmap current_file_dir_set;
33 struct string_list df_conflict_file_set;
34 struct unpack_trees_options unpack_opts;
35 struct index_state orig_index;
39 * For dir_rename_entry, directory names are stored as a full path from the
40 * toplevel of the repository and do not include a trailing '/'. Also:
42 * dir: original name of directory being renamed
43 * non_unique_new_dir: if true, could not determine new_dir
44 * new_dir: final name of directory being renamed
45 * possible_new_dirs: temporary used to help determine new_dir; see comments
46 * in get_directory_renames() for details
48 struct dir_rename_entry {
49 struct hashmap_entry ent; /* must be the first member! */
51 unsigned non_unique_new_dir:1;
52 struct strbuf new_dir;
53 struct string_list possible_new_dirs;
56 struct collision_entry {
57 struct hashmap_entry ent; /* must be the first member! */
59 struct string_list source_files;
60 unsigned reported_already:1;
63 static inline int merge_detect_rename(struct merge_options *o)
65 return o->merge_detect_rename >= 0 ? o->merge_detect_rename :
66 o->diff_detect_rename >= 0 ? o->diff_detect_rename : 1;
69 /* merge_trees() but with recursive ancestor consolidation */
70 int merge_recursive(struct merge_options *o,
73 struct commit_list *ancestors,
74 struct commit **result);
76 /* rename-detecting three-way merge, no recursion */
77 int merge_trees(struct merge_options *o,
81 struct tree **result);
84 * "git-merge-recursive" can be fed trees; wrap them into
85 * virtual commits and call merge_recursive() proper.
87 int merge_recursive_generic(struct merge_options *o,
88 const struct object_id *head,
89 const struct object_id *merge,
91 const struct object_id **ca,
92 struct commit **result);
94 void init_merge_options(struct merge_options *o);
95 struct tree *write_tree_from_memory(struct merge_options *o);
97 int parse_merge_opt(struct merge_options *out, const char *s);