]> git.ipfire.org Git - thirdparty/git.git/blame - unpack-trees.h
merge-recursive: make "Auto-merging" comment show for other merges
[thirdparty/git.git] / unpack-trees.h
CommitLineData
16da134b
JS
1#ifndef UNPACK_TREES_H
2#define UNPACK_TREES_H
3
64b1abe9 4#include "tree-walk.h"
7980872d
CB
5#include "string-list.h"
6
ca885a4f
JH
7#define MAX_UNPACK_TREES 8
8
16da134b 9struct unpack_trees_options;
08aefc9e 10struct exclude_list;
16da134b 11
5828e835 12typedef int (*merge_fn_t)(const struct cache_entry * const *src,
34110cd4 13 struct unpack_trees_options *options);
16da134b 14
08353ebb
MM
15enum unpack_trees_error_types {
16 ERROR_WOULD_OVERWRITE = 0,
17 ERROR_NOT_UPTODATE_FILE,
18 ERROR_NOT_UPTODATE_DIR,
08402b04
MM
19 ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN,
20 ERROR_WOULD_LOSE_UNTRACKED_REMOVED,
08353ebb
MM
21 ERROR_BIND_OVERLAP,
22 ERROR_SPARSE_NOT_UPTODATE_FILE,
08402b04
MM
23 ERROR_WOULD_LOSE_ORPHANED_OVERWRITTEN,
24 ERROR_WOULD_LOSE_ORPHANED_REMOVED,
a7bc845a 25 ERROR_WOULD_LOSE_SUBMODULE,
08353ebb 26 NB_UNPACK_TREES_ERROR_TYPES
8ccba008
JH
27};
28
dc1166e6
MM
29/*
30 * Sets the list of user-friendly error messages to be used by the
5e65ee35 31 * command "cmd" (either merge or checkout), and show_all_errors to 1.
dc1166e6 32 */
e294030f
MM
33void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
34 const char *cmd);
dc1166e6 35
16da134b 36struct unpack_trees_options {
5a56da58
SB
37 unsigned int reset,
38 merge,
39 update,
40 index_only,
41 nontrivial_merge,
42 trivial_merges_only,
43 verbose_update,
44 aggressive,
45 skip_unmerged,
46 initial_checkout,
47 diff_index_cached,
ba655da5 48 debug_unpack,
08aefc9e 49 skip_sparse_checkout,
e6c111b4 50 gently,
b4194828 51 exiting_early,
2c9078d0
JL
52 show_all_errors,
53 dry_run;
16da134b 54 const char *prefix;
da165f47 55 int cache_bottom;
f8a9d428 56 struct dir_struct *dir;
40e37256 57 struct pathspec *pathspec;
16da134b 58 merge_fn_t fn;
08353ebb 59 const char *msgs[NB_UNPACK_TREES_ERROR_TYPES];
e6c111b4
MM
60 /*
61 * Store error messages in an array, each case
62 * corresponding to a error message type
63 */
7980872d 64 struct string_list unpack_rejects[NB_UNPACK_TREES_ERROR_TYPES];
16da134b
JS
65
66 int head_idx;
67 int merge_size;
68
69 struct cache_entry *df_conflict_entry;
d1f2d7e8 70 void *unpack_data;
34110cd4
LT
71
72 struct index_state *dst_index;
32260ad5 73 struct index_state *src_index;
34110cd4 74 struct index_state result;
08aefc9e
NTND
75
76 struct exclude_list *el; /* for internal use */
16da134b
JS
77};
78
933bf40a 79extern int unpack_trees(unsigned n, struct tree_desc *t,
16da134b
JS
80 struct unpack_trees_options *options);
81
64b1abe9
EN
82int verify_uptodate(const struct cache_entry *ce,
83 struct unpack_trees_options *o);
84
5828e835
RS
85int threeway_merge(const struct cache_entry * const *stages,
86 struct unpack_trees_options *o);
87int twoway_merge(const struct cache_entry * const *src,
88 struct unpack_trees_options *o);
89int bind_merge(const struct cache_entry * const *src,
90 struct unpack_trees_options *o);
91int oneway_merge(const struct cache_entry * const *src,
92 struct unpack_trees_options *o);
076b0adc 93
16da134b 94#endif