Merge branch 'en/rename-directory-detection-reboot'
[git.git] / merge-recursive.h
blobfa7bc6b6836f99ab9c417e2865cd5a544488d025
1 #ifndef MERGE_RECURSIVE_H
2 #define MERGE_RECURSIVE_H
4 #include "unpack-trees.h"
5 #include "string-list.h"
7 struct merge_options {
8 const char *ancestor;
9 const char *branch1;
10 const char *branch2;
11 enum {
12 MERGE_RECURSIVE_NORMAL = 0,
13 MERGE_RECURSIVE_OURS,
14 MERGE_RECURSIVE_THEIRS
15 } recursive_variant;
16 const char *subtree_shift;
17 unsigned buffer_output; /* 1: output at end, 2: keep buffered */
18 unsigned renormalize : 1;
19 long xdl_opts;
20 int verbosity;
21 int diff_detect_rename;
22 int merge_detect_rename;
23 int diff_rename_limit;
24 int merge_rename_limit;
25 int rename_score;
26 int needed_rename_limit;
27 int show_rename_progress;
28 int call_depth;
29 struct strbuf obuf;
30 struct hashmap current_file_dir_set;
31 struct string_list df_conflict_file_set;
32 struct unpack_trees_options unpack_opts;
33 struct index_state orig_index;
37 * For dir_rename_entry, directory names are stored as a full path from the
38 * toplevel of the repository and do not include a trailing '/'. Also:
40 * dir: original name of directory being renamed
41 * non_unique_new_dir: if true, could not determine new_dir
42 * new_dir: final name of directory being renamed
43 * possible_new_dirs: temporary used to help determine new_dir; see comments
44 * in get_directory_renames() for details
46 struct dir_rename_entry {
47 struct hashmap_entry ent; /* must be the first member! */
48 char *dir;
49 unsigned non_unique_new_dir:1;
50 struct strbuf new_dir;
51 struct string_list possible_new_dirs;
54 struct collision_entry {
55 struct hashmap_entry ent; /* must be the first member! */
56 char *target_file;
57 struct string_list source_files;
58 unsigned reported_already:1;
61 static inline int merge_detect_rename(struct merge_options *o)
63 return o->merge_detect_rename >= 0 ? o->merge_detect_rename :
64 o->diff_detect_rename >= 0 ? o->diff_detect_rename : 1;
67 /* merge_trees() but with recursive ancestor consolidation */
68 int merge_recursive(struct merge_options *o,
69 struct commit *h1,
70 struct commit *h2,
71 struct commit_list *ancestors,
72 struct commit **result);
74 /* rename-detecting three-way merge, no recursion */
75 int merge_trees(struct merge_options *o,
76 struct tree *head,
77 struct tree *merge,
78 struct tree *common,
79 struct tree **result);
82 * "git-merge-recursive" can be fed trees; wrap them into
83 * virtual commits and call merge_recursive() proper.
85 int merge_recursive_generic(struct merge_options *o,
86 const struct object_id *head,
87 const struct object_id *merge,
88 int num_ca,
89 const struct object_id **ca,
90 struct commit **result);
92 void init_merge_options(struct merge_options *o);
93 struct tree *write_tree_from_memory(struct merge_options *o);
95 int parse_merge_opt(struct merge_options *out, const char *s);
97 #endif