blob: be8410ad1803bc10e5dbf74f39eecdfed53469b1 [file] [log] [blame]
Daniel Barkalowe1b3a2c2008-02-07 11:40:05 -05001#ifndef MERGE_RECURSIVE_H
2#define MERGE_RECURSIVE_H
3
Miklos Vajna696ee232008-09-03 19:08:56 +02004#include "string-list.h"
5
Miklos Vajna8a2fce12008-08-25 16:25:57 +02006struct merge_options {
7 const char *branch1;
8 const char *branch2;
Avery Pennarun8cc5b292009-11-25 21:23:55 -05009 enum {
Junio C Hamano85e51b72008-06-30 22:18:57 -070010 MERGE_RECURSIVE_NORMAL = 0,
Avery Pennarun8cc5b292009-11-25 21:23:55 -050011 MERGE_RECURSIVE_OURS,
12 MERGE_RECURSIVE_THEIRS,
13 } recursive_variant;
Junio C Hamano85e51b72008-06-30 22:18:57 -070014 const char *subtree_shift;
Miklos Vajna8a2fce12008-08-25 16:25:57 +020015 unsigned buffer_output : 1;
16 int verbosity;
17 int diff_rename_limit;
18 int merge_rename_limit;
Miklos Vajna50336392008-09-02 23:30:09 +020019 int call_depth;
Miklos Vajnac7d84922008-09-03 02:30:03 +020020 struct strbuf obuf;
Miklos Vajna696ee232008-09-03 19:08:56 +020021 struct string_list current_file_set;
22 struct string_list current_directory_set;
Miklos Vajna8a2fce12008-08-25 16:25:57 +020023};
24
Matthieu Moy264b7742009-11-29 13:18:32 +010025/* Return a list of user-friendly error messages to be used by merge */
26struct unpack_trees_error_msgs get_porcelain_error_msgs(void);
27
Miklos Vajna8a2fce12008-08-25 16:25:57 +020028/* merge_trees() but with recursive ancestor consolidation */
29int merge_recursive(struct merge_options *o,
30 struct commit *h1,
Daniel Barkalowe1b3a2c2008-02-07 11:40:05 -050031 struct commit *h2,
Daniel Barkalowe1b3a2c2008-02-07 11:40:05 -050032 struct commit_list *ancestors,
33 struct commit **result);
34
Miklos Vajna8a2fce12008-08-25 16:25:57 +020035/* rename-detecting three-way merge, no recursion */
36int merge_trees(struct merge_options *o,
37 struct tree *head,
Daniel Barkalowe1b3a2c2008-02-07 11:40:05 -050038 struct tree *merge,
39 struct tree *common,
Daniel Barkalowe1b3a2c2008-02-07 11:40:05 -050040 struct tree **result);
Daniel Barkalowe1b3a2c2008-02-07 11:40:05 -050041
Miklos Vajna8a2fce12008-08-25 16:25:57 +020042/*
43 * "git-merge-recursive" can be fed trees; wrap them into
44 * virtual commits and call merge_recursive() proper.
45 */
46int merge_recursive_generic(struct merge_options *o,
47 const unsigned char *head,
48 const unsigned char *merge,
49 int num_ca,
50 const unsigned char **ca,
51 struct commit **result);
52
53void init_merge_options(struct merge_options *o);
54struct tree *write_tree_from_memory(struct merge_options *o);
Miklos Vajna9047ebb2008-08-12 18:45:14 +020055
Daniel Barkalowe1b3a2c2008-02-07 11:40:05 -050056#endif