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