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