unpack_trees: group error messages by type
[git/git.git] / unpack-trees.h
CommitLineData
16da134b
JS
1#ifndef UNPACK_TREES_H
2#define UNPACK_TREES_H
3
ca885a4f
JH
4#define MAX_UNPACK_TREES 8
5
16da134b 6struct unpack_trees_options;
08aefc9e 7struct exclude_list;
16da134b
JS
8
9typedef int (*merge_fn_t)(struct cache_entry **src,
34110cd4 10 struct unpack_trees_options *options);
16da134b 11
08353ebb
MM
12enum unpack_trees_error_types {
13 ERROR_WOULD_OVERWRITE = 0,
14 ERROR_NOT_UPTODATE_FILE,
15 ERROR_NOT_UPTODATE_DIR,
08402b04
MM
16 ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN,
17 ERROR_WOULD_LOSE_UNTRACKED_REMOVED,
08353ebb
MM
18 ERROR_BIND_OVERLAP,
19 ERROR_SPARSE_NOT_UPTODATE_FILE,
08402b04
MM
20 ERROR_WOULD_LOSE_ORPHANED_OVERWRITTEN,
21 ERROR_WOULD_LOSE_ORPHANED_REMOVED,
08353ebb 22 NB_UNPACK_TREES_ERROR_TYPES
8ccba008
JH
23};
24
e6c111b4
MM
25struct rejected_paths_list {
26 char *path;
27 struct rejected_paths_list *next;
28};
29
16da134b 30struct unpack_trees_options {
5a56da58
SB
31 unsigned int reset,
32 merge,
33 update,
34 index_only,
35 nontrivial_merge,
36 trivial_merges_only,
37 verbose_update,
38 aggressive,
39 skip_unmerged,
40 initial_checkout,
41 diff_index_cached,
ba655da5 42 debug_unpack,
08aefc9e 43 skip_sparse_checkout,
e6c111b4
MM
44 gently,
45 show_all_errors;
16da134b 46 const char *prefix;
da165f47 47 int cache_bottom;
f8a9d428 48 struct dir_struct *dir;
16da134b 49 merge_fn_t fn;
08353ebb 50 const char *msgs[NB_UNPACK_TREES_ERROR_TYPES];
e6c111b4
MM
51 /*
52 * Store error messages in an array, each case
53 * corresponding to a error message type
54 */
55 struct rejected_paths_list *unpack_rejects[NB_UNPACK_TREES_ERROR_TYPES];
16da134b
JS
56
57 int head_idx;
58 int merge_size;
59
60 struct cache_entry *df_conflict_entry;
d1f2d7e8 61 void *unpack_data;
34110cd4
LT
62
63 struct index_state *dst_index;
32260ad5 64 struct index_state *src_index;
34110cd4 65 struct index_state result;
08aefc9e
NTND
66
67 struct exclude_list *el; /* for internal use */
16da134b
JS
68};
69
933bf40a 70extern int unpack_trees(unsigned n, struct tree_desc *t,
16da134b
JS
71 struct unpack_trees_options *options);
72
34110cd4
LT
73int threeway_merge(struct cache_entry **stages, struct unpack_trees_options *o);
74int twoway_merge(struct cache_entry **src, struct unpack_trees_options *o);
75int bind_merge(struct cache_entry **src, struct unpack_trees_options *o);
76int oneway_merge(struct cache_entry **src, struct unpack_trees_options *o);
076b0adc 77
16da134b 78#endif