]> git.ipfire.org Git - thirdparty/git.git/blame - merge-recursive.h
l10n: git.pot: v2.19.0 round 1 (382 new, 30 removed)
[thirdparty/git.git] / merge-recursive.h
CommitLineData
e1b3a2ca
DB
1#ifndef MERGE_RECURSIVE_H
2#define MERGE_RECURSIVE_H
3
696ee23c 4#include "string-list.h"
ef3ca954
EN
5#include "unpack-trees.h"
6
7struct commit;
696ee23c 8
8a2fce18 9struct merge_options {
4c5868f4 10 const char *ancestor;
8a2fce18
MV
11 const char *branch1;
12 const char *branch2;
8cc5b290 13 enum {
85e51b78 14 MERGE_RECURSIVE_NORMAL = 0,
8cc5b290 15 MERGE_RECURSIVE_OURS,
4b05548f 16 MERGE_RECURSIVE_THEIRS
8cc5b290 17 } recursive_variant;
85e51b78 18 const char *subtree_shift;
f1e2426b 19 unsigned buffer_output; /* 1: output at end, 2: keep buffered */
1bc0ab7c 20 unsigned renormalize : 1;
58a1ece4 21 long xdl_opts;
8a2fce18 22 int verbosity;
85b46030
BP
23 int diff_detect_rename;
24 int merge_detect_rename;
8a2fce18
MV
25 int diff_rename_limit;
26 int merge_rename_limit;
10ae7526 27 int rename_score;
bf0ab10f 28 int needed_rename_limit;
99bfc669 29 int show_rename_progress;
5033639c 30 int call_depth;
c7d84924 31 struct strbuf obuf;
fc65b00d 32 struct hashmap current_file_dir_set;
70cc3d36 33 struct string_list df_conflict_file_set;
64b1abe9 34 struct unpack_trees_options unpack_opts;
a35edc84 35 struct index_state orig_index;
ea625cb0
EN
36};
37
7fe40b88
EN
38/*
39 * For dir_rename_entry, directory names are stored as a full path from the
40 * toplevel of the repository and do not include a trailing '/'. Also:
41 *
42 * dir: original name of directory being renamed
43 * non_unique_new_dir: if true, could not determine new_dir
44 * new_dir: final name of directory being renamed
45 * possible_new_dirs: temporary used to help determine new_dir; see comments
46 * in get_directory_renames() for details
47 */
48struct dir_rename_entry {
49 struct hashmap_entry ent; /* must be the first member! */
50 char *dir;
51 unsigned non_unique_new_dir:1;
52 struct strbuf new_dir;
53 struct string_list possible_new_dirs;
54};
55
e95ab70a
EN
56struct collision_entry {
57 struct hashmap_entry ent; /* must be the first member! */
58 char *target_file;
59 struct string_list source_files;
60 unsigned reported_already:1;
61};
62
85b46030
BP
63static inline int merge_detect_rename(struct merge_options *o)
64{
65 return o->merge_detect_rename >= 0 ? o->merge_detect_rename :
66 o->diff_detect_rename >= 0 ? o->diff_detect_rename : 1;
67}
68
8a2fce18
MV
69/* merge_trees() but with recursive ancestor consolidation */
70int merge_recursive(struct merge_options *o,
71 struct commit *h1,
e1b3a2ca 72 struct commit *h2,
e1b3a2ca
DB
73 struct commit_list *ancestors,
74 struct commit **result);
75
8a2fce18
MV
76/* rename-detecting three-way merge, no recursion */
77int merge_trees(struct merge_options *o,
78 struct tree *head,
e1b3a2ca
DB
79 struct tree *merge,
80 struct tree *common,
e1b3a2ca 81 struct tree **result);
e1b3a2ca 82
8a2fce18
MV
83/*
84 * "git-merge-recursive" can be fed trees; wrap them into
85 * virtual commits and call merge_recursive() proper.
86 */
87int merge_recursive_generic(struct merge_options *o,
4e8161a8 88 const struct object_id *head,
89 const struct object_id *merge,
8a2fce18 90 int num_ca,
4e8161a8 91 const struct object_id **ca,
8a2fce18
MV
92 struct commit **result);
93
94void init_merge_options(struct merge_options *o);
95struct tree *write_tree_from_memory(struct merge_options *o);
9047ebbc 96
635a7bb1
JN
97int parse_merge_opt(struct merge_options *out, const char *s);
98
e1b3a2ca 99#endif