5 #include "read-cache-ll.h"
7 #include "string-list.h"
10 #define MAX_UNPACK_TREES 8
13 struct unpack_trees_options
;
16 typedef int (*merge_fn_t
)(const struct cache_entry
* const *src
,
17 struct unpack_trees_options
*options
);
19 enum unpack_trees_error_types
{
20 ERROR_WOULD_OVERWRITE
= 0,
21 ERROR_NOT_UPTODATE_FILE
,
22 ERROR_NOT_UPTODATE_DIR
,
24 ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN
,
25 ERROR_WOULD_LOSE_UNTRACKED_REMOVED
,
27 ERROR_WOULD_LOSE_SUBMODULE
,
29 NB_UNPACK_TREES_ERROR_TYPES
,
31 WARNING_SPARSE_NOT_UPTODATE_FILE
,
32 WARNING_SPARSE_UNMERGED_FILE
,
33 WARNING_SPARSE_ORPHANED_NOT_OVERWRITTEN
,
35 NB_UNPACK_TREES_WARNING_TYPES
,
39 * Sets the list of user-friendly error messages to be used by the
40 * command "cmd" (either merge or checkout), and show_all_errors to 1.
42 void setup_unpack_trees_porcelain(struct unpack_trees_options
*opts
,
46 * Frees resources allocated by setup_unpack_trees_porcelain().
48 void clear_unpack_trees_porcelain(struct unpack_trees_options
*opts
);
50 enum unpack_trees_reset_type
{
51 UNPACK_RESET_NONE
= 0, /* traditional "false" value; still valid */
52 UNPACK_RESET_INVALID
= 1, /* "true" no longer valid; use below values */
53 UNPACK_RESET_PROTECT_UNTRACKED
,
54 UNPACK_RESET_OVERWRITE_UNTRACKED
57 struct unpack_trees_options
{
73 skip_cache_tree_update
;
74 enum unpack_trees_reset_type reset
;
76 const char *super_prefix
;
77 struct pathspec
*pathspec
;
82 struct cache_entry
*df_conflict_entry
; /* output only */
85 struct index_state
*dst_index
;
86 struct index_state
*src_index
;
88 struct checkout_metadata meta
;
90 struct unpack_trees_options_internal
{
91 unsigned int nontrivial_merge
,
93 debug_unpack
; /* used by read-tree debugging */
95 int merge_size
; /* used by read-tree debugging */
97 const char *msgs
[NB_UNPACK_TREES_WARNING_TYPES
];
98 struct strvec msgs_to_free
;
101 * Store error messages in an array, each case
102 * corresponding to a error message type
104 struct string_list unpack_rejects
[NB_UNPACK_TREES_WARNING_TYPES
];
106 struct index_state result
;
108 struct pattern_list
*pl
;
109 struct dir_struct
*dir
;
113 int unpack_trees(unsigned n
, struct tree_desc
*t
,
114 struct unpack_trees_options
*options
);
116 enum update_sparsity_result
{
117 UPDATE_SPARSITY_SUCCESS
= 0,
118 UPDATE_SPARSITY_WARNINGS
= 1,
119 UPDATE_SPARSITY_INDEX_UPDATE_FAILURES
= -1,
120 UPDATE_SPARSITY_WORKTREE_UPDATE_FAILURES
= -2
123 enum update_sparsity_result
update_sparsity(struct unpack_trees_options
*options
,
124 struct pattern_list
*pl
);
126 int verify_uptodate(const struct cache_entry
*ce
,
127 struct unpack_trees_options
*o
);
129 int threeway_merge(const struct cache_entry
* const *stages
,
130 struct unpack_trees_options
*o
);
131 int twoway_merge(const struct cache_entry
* const *src
,
132 struct unpack_trees_options
*o
);
133 int bind_merge(const struct cache_entry
* const *src
,
134 struct unpack_trees_options
*o
);
135 int oneway_merge(const struct cache_entry
* const *src
,
136 struct unpack_trees_options
*o
);
137 int stash_worktree_untracked_merge(const struct cache_entry
* const *src
,
138 struct unpack_trees_options
*o
);