]> git.ipfire.org Git - thirdparty/git.git/blame - merge-recursive.h
gitweb: correctly store previous rev in javascript-actions mode
[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
0d6caa2d
NTND
9struct repository;
10
8a2fce18 11struct merge_options {
4c5868f4 12 const char *ancestor;
8a2fce18
MV
13 const char *branch1;
14 const char *branch2;
8cc5b290 15 enum {
85e51b78 16 MERGE_RECURSIVE_NORMAL = 0,
8cc5b290 17 MERGE_RECURSIVE_OURS,
4b05548f 18 MERGE_RECURSIVE_THEIRS
8cc5b290 19 } recursive_variant;
85e51b78 20 const char *subtree_shift;
f1e2426b 21 unsigned buffer_output; /* 1: output at end, 2: keep buffered */
1bc0ab7c 22 unsigned renormalize : 1;
58a1ece4 23 long xdl_opts;
8a2fce18 24 int verbosity;
5fdddd9b 25 int detect_directory_renames;
85b46030
BP
26 int diff_detect_rename;
27 int merge_detect_rename;
8a2fce18
MV
28 int diff_rename_limit;
29 int merge_rename_limit;
10ae7526 30 int rename_score;
bf0ab10f 31 int needed_rename_limit;
99bfc669 32 int show_rename_progress;
5033639c 33 int call_depth;
c7d84924 34 struct strbuf obuf;
fc65b00d 35 struct hashmap current_file_dir_set;
70cc3d36 36 struct string_list df_conflict_file_set;
64b1abe9 37 struct unpack_trees_options unpack_opts;
a35edc84 38 struct index_state orig_index;
0d6caa2d 39 struct repository *repo;
ea625cb0
EN
40};
41
7fe40b88
EN
42/*
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:
45 *
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
51 */
52struct 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;
58};
59
e95ab70a
EN
60struct 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;
65};
66
85b46030
BP
67static inline int merge_detect_rename(struct merge_options *o)
68{
69 return o->merge_detect_rename >= 0 ? o->merge_detect_rename :
70 o->diff_detect_rename >= 0 ? o->diff_detect_rename : 1;
71}
72
8a2fce18
MV
73/* merge_trees() but with recursive ancestor consolidation */
74int merge_recursive(struct merge_options *o,
75 struct commit *h1,
e1b3a2ca 76 struct commit *h2,
e1b3a2ca
DB
77 struct commit_list *ancestors,
78 struct commit **result);
79
8a2fce18
MV
80/* rename-detecting three-way merge, no recursion */
81int merge_trees(struct merge_options *o,
82 struct tree *head,
e1b3a2ca
DB
83 struct tree *merge,
84 struct tree *common,
e1b3a2ca 85 struct tree **result);
e1b3a2ca 86
8a2fce18
MV
87/*
88 * "git-merge-recursive" can be fed trees; wrap them into
89 * virtual commits and call merge_recursive() proper.
90 */
91int merge_recursive_generic(struct merge_options *o,
4e8161a8 92 const struct object_id *head,
93 const struct object_id *merge,
8a2fce18 94 int num_ca,
4e8161a8 95 const struct object_id **ca,
8a2fce18
MV
96 struct commit **result);
97
0d6caa2d
NTND
98void init_merge_options(struct merge_options *o,
99 struct repository *repo);
8a2fce18 100struct tree *write_tree_from_memory(struct merge_options *o);
9047ebbc 101
635a7bb1
JN
102int parse_merge_opt(struct merge_options *out, const char *s);
103
e1b3a2ca 104#endif