merge-recursive: fix remainder of was_dirty() to use original index
[git.git] / merge-recursive.h
blob248093e407c7744b1e3e9a5bd5780375a1c6c07f
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 detect_rename;
22 int diff_rename_limit;
23 int merge_rename_limit;
24 int rename_score;
25 int needed_rename_limit;
26 int show_rename_progress;
27 int call_depth;
28 struct strbuf obuf;
29 struct hashmap current_file_dir_set;
30 struct string_list df_conflict_file_set;
31 struct unpack_trees_options unpack_opts;
32 struct index_state orig_index;
36 * For dir_rename_entry, directory names are stored as a full path from the
37 * toplevel of the repository and do not include a trailing '/'. Also:
39 * dir: original name of directory being renamed
40 * non_unique_new_dir: if true, could not determine new_dir
41 * new_dir: final name of directory being renamed
42 * possible_new_dirs: temporary used to help determine new_dir; see comments
43 * in get_directory_renames() for details
45 struct dir_rename_entry {
46 struct hashmap_entry ent; /* must be the first member! */
47 char *dir;
48 unsigned non_unique_new_dir:1;
49 struct strbuf new_dir;
50 struct string_list possible_new_dirs;
53 struct collision_entry {
54 struct hashmap_entry ent; /* must be the first member! */
55 char *target_file;
56 struct string_list source_files;
57 unsigned reported_already:1;
60 /* merge_trees() but with recursive ancestor consolidation */
61 int merge_recursive(struct merge_options *o,
62 struct commit *h1,
63 struct commit *h2,
64 struct commit_list *ancestors,
65 struct commit **result);
67 /* rename-detecting three-way merge, no recursion */
68 int merge_trees(struct merge_options *o,
69 struct tree *head,
70 struct tree *merge,
71 struct tree *common,
72 struct tree **result);
75 * "git-merge-recursive" can be fed trees; wrap them into
76 * virtual commits and call merge_recursive() proper.
78 int merge_recursive_generic(struct merge_options *o,
79 const struct object_id *head,
80 const struct object_id *merge,
81 int num_ca,
82 const struct object_id **ca,
83 struct commit **result);
85 void init_merge_options(struct merge_options *o);
86 struct tree *write_tree_from_memory(struct merge_options *o);
88 int parse_merge_opt(struct merge_options *out, const char *s);
90 #endif