]>
Commit | Line | Data |
---|---|---|
16da134b JS |
1 | #ifndef UNPACK_TREES_H |
2 | #define UNPACK_TREES_H | |
3 | ||
ef3ca954 | 4 | #include "cache.h" |
dbbcd44f | 5 | #include "strvec.h" |
ef3ca954 EN |
6 | #include "string-list.h" |
7 | #include "tree-walk.h" | |
7980872d | 8 | |
5290d451 | 9 | #define MAX_UNPACK_TREES MAX_TRAVERSE_TREES |
ca885a4f | 10 | |
ef3ca954 | 11 | struct cache_entry; |
16da134b | 12 | struct unpack_trees_options; |
caa3d554 | 13 | struct pattern_list; |
16da134b | 14 | |
5828e835 | 15 | typedef int (*merge_fn_t)(const struct cache_entry * const *src, |
34110cd4 | 16 | struct unpack_trees_options *options); |
16da134b | 17 | |
08353ebb MM |
18 | enum unpack_trees_error_types { |
19 | ERROR_WOULD_OVERWRITE = 0, | |
20 | ERROR_NOT_UPTODATE_FILE, | |
21 | ERROR_NOT_UPTODATE_DIR, | |
08402b04 MM |
22 | ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN, |
23 | ERROR_WOULD_LOSE_UNTRACKED_REMOVED, | |
08353ebb | 24 | ERROR_BIND_OVERLAP, |
a7bc845a | 25 | ERROR_WOULD_LOSE_SUBMODULE, |
1ac83f42 | 26 | |
6271d77c EN |
27 | NB_UNPACK_TREES_ERROR_TYPES, |
28 | ||
1ac83f42 | 29 | WARNING_SPARSE_NOT_UPTODATE_FILE, |
ebb568b9 | 30 | WARNING_SPARSE_UNMERGED_FILE, |
1ac83f42 EN |
31 | WARNING_SPARSE_ORPHANED_NOT_OVERWRITTEN, |
32 | ||
6271d77c | 33 | NB_UNPACK_TREES_WARNING_TYPES, |
8ccba008 JH |
34 | }; |
35 | ||
dc1166e6 MM |
36 | /* |
37 | * Sets the list of user-friendly error messages to be used by the | |
5e65ee35 | 38 | * command "cmd" (either merge or checkout), and show_all_errors to 1. |
dc1166e6 | 39 | */ |
e294030f MM |
40 | void setup_unpack_trees_porcelain(struct unpack_trees_options *opts, |
41 | const char *cmd); | |
dc1166e6 | 42 | |
1c41d280 MÅ |
43 | /* |
44 | * Frees resources allocated by setup_unpack_trees_porcelain(). | |
45 | */ | |
46 | void clear_unpack_trees_porcelain(struct unpack_trees_options *opts); | |
47 | ||
16da134b | 48 | struct unpack_trees_options { |
5a56da58 SB |
49 | unsigned int reset, |
50 | merge, | |
51 | update, | |
b878579a | 52 | clone, |
5a56da58 SB |
53 | index_only, |
54 | nontrivial_merge, | |
55 | trivial_merges_only, | |
56 | verbose_update, | |
57 | aggressive, | |
58 | skip_unmerged, | |
59 | initial_checkout, | |
60 | diff_index_cached, | |
ba655da5 | 61 | debug_unpack, |
08aefc9e | 62 | skip_sparse_checkout, |
b165fac8 | 63 | quiet, |
b4194828 | 64 | exiting_early, |
2c9078d0 | 65 | show_all_errors, |
fa0bde45 | 66 | dry_run; |
16da134b | 67 | const char *prefix; |
da165f47 | 68 | int cache_bottom; |
f8a9d428 | 69 | struct dir_struct *dir; |
40e37256 | 70 | struct pathspec *pathspec; |
16da134b | 71 | merge_fn_t fn; |
6271d77c | 72 | const char *msgs[NB_UNPACK_TREES_WARNING_TYPES]; |
c972bf4c | 73 | struct strvec msgs_to_free; |
e6c111b4 MM |
74 | /* |
75 | * Store error messages in an array, each case | |
76 | * corresponding to a error message type | |
77 | */ | |
6271d77c | 78 | struct string_list unpack_rejects[NB_UNPACK_TREES_WARNING_TYPES]; |
16da134b JS |
79 | |
80 | int head_idx; | |
81 | int merge_size; | |
82 | ||
83 | struct cache_entry *df_conflict_entry; | |
d1f2d7e8 | 84 | void *unpack_data; |
34110cd4 LT |
85 | |
86 | struct index_state *dst_index; | |
32260ad5 | 87 | struct index_state *src_index; |
34110cd4 | 88 | struct index_state result; |
08aefc9e | 89 | |
caa3d554 | 90 | struct pattern_list *pl; /* for internal use */ |
13e7ed6a | 91 | struct checkout_metadata meta; |
16da134b JS |
92 | }; |
93 | ||
340f4bc9 NTND |
94 | int unpack_trees(unsigned n, struct tree_desc *t, |
95 | struct unpack_trees_options *options); | |
16da134b | 96 | |
7af7a258 EN |
97 | enum update_sparsity_result { |
98 | UPDATE_SPARSITY_SUCCESS = 0, | |
99 | UPDATE_SPARSITY_WARNINGS = 1, | |
100 | UPDATE_SPARSITY_INDEX_UPDATE_FAILURES = -1, | |
101 | UPDATE_SPARSITY_WORKTREE_UPDATE_FAILURES = -2 | |
102 | }; | |
103 | ||
104 | enum update_sparsity_result update_sparsity(struct unpack_trees_options *options); | |
105 | ||
64b1abe9 EN |
106 | int verify_uptodate(const struct cache_entry *ce, |
107 | struct unpack_trees_options *o); | |
108 | ||
5828e835 RS |
109 | int threeway_merge(const struct cache_entry * const *stages, |
110 | struct unpack_trees_options *o); | |
111 | int twoway_merge(const struct cache_entry * const *src, | |
112 | struct unpack_trees_options *o); | |
113 | int bind_merge(const struct cache_entry * const *src, | |
114 | struct unpack_trees_options *o); | |
115 | int oneway_merge(const struct cache_entry * const *src, | |
116 | struct unpack_trees_options *o); | |
d3c7bf73 DL |
117 | int stash_worktree_untracked_merge(const struct cache_entry * const *src, |
118 | struct unpack_trees_options *o); | |
076b0adc | 119 | |
16da134b | 120 | #endif |