blob: 58f3435e9e854ab82c2fd0c10c55520bc69e5ed0 [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 {
Jonathan Nieder4c5868f2010-03-20 19:41:38 -05007 const char *ancestor;
Miklos Vajna8a2fce12008-08-25 16:25:57 +02008 const char *branch1;
9 const char *branch2;
Avery Pennarun8cc5b292009-11-25 21:23:55 -050010 enum {
Junio C Hamano85e51b72008-06-30 22:18:57 -070011 MERGE_RECURSIVE_NORMAL = 0,
Avery Pennarun8cc5b292009-11-25 21:23:55 -050012 MERGE_RECURSIVE_OURS,
Gary V. Vaughan4b055482010-05-14 09:31:35 +000013 MERGE_RECURSIVE_THEIRS
Avery Pennarun8cc5b292009-11-25 21:23:55 -050014 } recursive_variant;
Junio C Hamano85e51b72008-06-30 22:18:57 -070015 const char *subtree_shift;
Miklos Vajna8a2fce12008-08-25 16:25:57 +020016 unsigned buffer_output : 1;
Jonathan Nieder1bc0ab72010-08-05 06:15:32 -050017 unsigned renormalize : 1;
Justin Frankel58a1ece2010-08-26 00:50:45 -050018 long xdl_opts;
Miklos Vajna8a2fce12008-08-25 16:25:57 +020019 int verbosity;
20 int diff_rename_limit;
21 int merge_rename_limit;
Kevin Ballard10ae7522010-09-27 16:58:25 -070022 int rename_score;
Jeff Kingbf0ab102011-02-19 05:20:51 -050023 int needed_rename_limit;
Jeff King99bfc662011-02-20 04:53:21 -050024 int show_rename_progress;
Miklos Vajna50336392008-09-02 23:30:09 +020025 int call_depth;
Miklos Vajnac7d84922008-09-03 02:30:03 +020026 struct strbuf obuf;
Miklos Vajna696ee232008-09-03 19:08:56 +020027 struct string_list current_file_set;
28 struct string_list current_directory_set;
Elijah Newren70cc3d32011-08-11 23:19:58 -060029 struct string_list df_conflict_file_set;
Miklos Vajna8a2fce12008-08-25 16:25:57 +020030};
31
32/* merge_trees() but with recursive ancestor consolidation */
33int merge_recursive(struct merge_options *o,
34 struct commit *h1,
Daniel Barkalowe1b3a2c2008-02-07 11:40:05 -050035 struct commit *h2,
Daniel Barkalowe1b3a2c2008-02-07 11:40:05 -050036 struct commit_list *ancestors,
37 struct commit **result);
38
Miklos Vajna8a2fce12008-08-25 16:25:57 +020039/* rename-detecting three-way merge, no recursion */
40int merge_trees(struct merge_options *o,
41 struct tree *head,
Daniel Barkalowe1b3a2c2008-02-07 11:40:05 -050042 struct tree *merge,
43 struct tree *common,
Daniel Barkalowe1b3a2c2008-02-07 11:40:05 -050044 struct tree **result);
Daniel Barkalowe1b3a2c2008-02-07 11:40:05 -050045
Miklos Vajna8a2fce12008-08-25 16:25:57 +020046/*
47 * "git-merge-recursive" can be fed trees; wrap them into
48 * virtual commits and call merge_recursive() proper.
49 */
50int merge_recursive_generic(struct merge_options *o,
51 const unsigned char *head,
52 const unsigned char *merge,
53 int num_ca,
54 const unsigned char **ca,
55 struct commit **result);
56
57void init_merge_options(struct merge_options *o);
58struct tree *write_tree_from_memory(struct merge_options *o);
Miklos Vajna9047ebb2008-08-12 18:45:14 +020059
Jonathan Nieder635a7bb2010-08-26 00:47:58 -050060int parse_merge_opt(struct merge_options *out, const char *s);
61
Christian Couderc674d052010-03-31 21:22:07 +020062/* builtin/merge.c */
Jonathan Nieder67ac1e12010-12-10 18:51:44 -060063int try_merge_command(const char *strategy, size_t xopts_nr,
64 const char **xopts, struct commit_list *common,
65 const char *head_arg, struct commit_list *remotes);
Christian Couderc674d052010-03-31 21:22:07 +020066
Daniel Barkalowe1b3a2c2008-02-07 11:40:05 -050067#endif