blob: 80d69d140195cc3ba1054050569e56bfc0277b56 [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;
Johannes Schindelinf1e24262016-08-01 13:44:50 +020016 unsigned buffer_output; /* 1: output at end, 2: keep buffered */
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;
Felipe Gonçalves Assisd2b11ec2016-02-17 01:15:25 -020020 int detect_rename;
Miklos Vajna8a2fce12008-08-25 16:25:57 +020021 int diff_rename_limit;
22 int merge_rename_limit;
Kevin Ballard10ae7522010-09-27 16:58:25 -070023 int rename_score;
Jeff Kingbf0ab102011-02-19 05:20:51 -050024 int needed_rename_limit;
Jeff King99bfc662011-02-20 04:53:21 -050025 int show_rename_progress;
Miklos Vajna50336392008-09-02 23:30:09 +020026 int call_depth;
Miklos Vajnac7d84922008-09-03 02:30:03 +020027 struct strbuf obuf;
Kevin Willfordfc65b002017-09-07 10:25:56 -060028 struct hashmap current_file_dir_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,
brian m. carlson4e8161a2016-06-24 23:09:28 +000051 const struct object_id *head,
52 const struct object_id *merge,
Miklos Vajna8a2fce12008-08-25 16:25:57 +020053 int num_ca,
brian m. carlson4e8161a2016-06-24 23:09:28 +000054 const struct object_id **ca,
Miklos Vajna8a2fce12008-08-25 16:25:57 +020055 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
Daniel Barkalowe1b3a2c2008-02-07 11:40:05 -050062#endif