d62bba9baa70822ef2079781faafd1596f41e2b6
1#ifndef UNPACK_TREES_H
2#define UNPACK_TREES_H
3
4#define MAX_UNPACK_TREES 8
5
6struct unpack_trees_options;
7struct exclude_list;
8
9typedef int (*merge_fn_t)(struct cache_entry **src,
10 struct unpack_trees_options *options);
11
12enum unpack_trees_error_types {
13 ERROR_WOULD_OVERWRITE = 0,
14 ERROR_NOT_UPTODATE_FILE,
15 ERROR_NOT_UPTODATE_DIR,
16 ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN,
17 ERROR_WOULD_LOSE_UNTRACKED_REMOVED,
18 ERROR_BIND_OVERLAP,
19 ERROR_SPARSE_NOT_UPTODATE_FILE,
20 ERROR_WOULD_LOSE_ORPHANED_OVERWRITTEN,
21 ERROR_WOULD_LOSE_ORPHANED_REMOVED,
22 NB_UNPACK_TREES_ERROR_TYPES
23};
24
25/*
26 * Sets the list of user-friendly error messages to be used by the
27 * command "cmd" (either merge or checkout)
28 */
29void setup_unpack_trees_porcelain(const char **msgs, const char *cmd);
30
31struct rejected_paths_list {
32 char *path;
33 struct rejected_paths_list *next;
34};
35
36struct unpack_trees_options {
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,
48 debug_unpack,
49 skip_sparse_checkout,
50 gently,
51 show_all_errors;
52 const char *prefix;
53 int cache_bottom;
54 struct dir_struct *dir;
55 merge_fn_t fn;
56 const char *msgs[NB_UNPACK_TREES_ERROR_TYPES];
57 /*
58 * Store error messages in an array, each case
59 * corresponding to a error message type
60 */
61 struct rejected_paths_list *unpack_rejects[NB_UNPACK_TREES_ERROR_TYPES];
62
63 int head_idx;
64 int merge_size;
65
66 struct cache_entry *df_conflict_entry;
67 void *unpack_data;
68
69 struct index_state *dst_index;
70 struct index_state *src_index;
71 struct index_state result;
72
73 struct exclude_list *el; /* for internal use */
74};
75
76extern int unpack_trees(unsigned n, struct tree_desc *t,
77 struct unpack_trees_options *options);
78
79int threeway_merge(struct cache_entry **stages, struct unpack_trees_options *o);
80int twoway_merge(struct cache_entry **src, struct unpack_trees_options *o);
81int bind_merge(struct cache_entry **src, struct unpack_trees_options *o);
82int oneway_merge(struct cache_entry **src, struct unpack_trees_options *o);
83
84#endif