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