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