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