6 #include "string-list.h"
9 #define MAX_UNPACK_TREES MAX_TRAVERSE_TREES
12 struct unpack_trees_options
;
15 typedef int (*merge_fn_t
)(const struct cache_entry
* const *src
,
16 struct unpack_trees_options
*options
);
18 enum unpack_trees_error_types
{
19 ERROR_WOULD_OVERWRITE
= 0,
20 ERROR_NOT_UPTODATE_FILE
,
21 ERROR_NOT_UPTODATE_DIR
,
23 ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN
,
24 ERROR_WOULD_LOSE_UNTRACKED_REMOVED
,
26 ERROR_WOULD_LOSE_SUBMODULE
,
28 NB_UNPACK_TREES_ERROR_TYPES
,
30 WARNING_SPARSE_NOT_UPTODATE_FILE
,
31 WARNING_SPARSE_UNMERGED_FILE
,
32 WARNING_SPARSE_ORPHANED_NOT_OVERWRITTEN
,
34 NB_UNPACK_TREES_WARNING_TYPES
,
38 * Sets the list of user-friendly error messages to be used by the
39 * command "cmd" (either merge or checkout), and show_all_errors to 1.
41 void setup_unpack_trees_porcelain(struct unpack_trees_options
*opts
,
45 * Frees resources allocated by setup_unpack_trees_porcelain().
47 void clear_unpack_trees_porcelain(struct unpack_trees_options
*opts
);
49 enum unpack_trees_reset_type
{
50 UNPACK_RESET_NONE
= 0, /* traditional "false" value; still valid */
51 UNPACK_RESET_INVALID
= 1, /* "true" no longer valid; use below values */
52 UNPACK_RESET_PROTECT_UNTRACKED
,
53 UNPACK_RESET_OVERWRITE_UNTRACKED
56 struct unpack_trees_options
{
72 skip_cache_tree_update
;
73 enum unpack_trees_reset_type reset
;
75 const char *super_prefix
;
76 struct pathspec
*pathspec
;
81 struct cache_entry
*df_conflict_entry
; /* output only */
84 struct index_state
*dst_index
;
85 struct index_state
*src_index
;
87 struct checkout_metadata meta
;
89 struct unpack_trees_options_internal
{
90 unsigned int nontrivial_merge
,
92 debug_unpack
; /* used by read-tree debugging */
94 int merge_size
; /* used by read-tree debugging */
96 const char *msgs
[NB_UNPACK_TREES_WARNING_TYPES
];
97 struct strvec msgs_to_free
;
100 * Store error messages in an array, each case
101 * corresponding to a error message type
103 struct string_list unpack_rejects
[NB_UNPACK_TREES_WARNING_TYPES
];
105 struct index_state result
;
107 struct pattern_list
*pl
;
108 struct dir_struct
*dir
;
112 int unpack_trees(unsigned n
, struct tree_desc
*t
,
113 struct unpack_trees_options
*options
);
115 enum update_sparsity_result
{
116 UPDATE_SPARSITY_SUCCESS
= 0,
117 UPDATE_SPARSITY_WARNINGS
= 1,
118 UPDATE_SPARSITY_INDEX_UPDATE_FAILURES
= -1,
119 UPDATE_SPARSITY_WORKTREE_UPDATE_FAILURES
= -2
122 enum update_sparsity_result
update_sparsity(struct unpack_trees_options
*options
,
123 struct pattern_list
*pl
);
125 int verify_uptodate(const struct cache_entry
*ce
,
126 struct unpack_trees_options
*o
);
128 int threeway_merge(const struct cache_entry
* const *stages
,
129 struct unpack_trees_options
*o
);
130 int twoway_merge(const struct cache_entry
* const *src
,
131 struct unpack_trees_options
*o
);
132 int bind_merge(const struct cache_entry
* const *src
,
133 struct unpack_trees_options
*o
);
134 int oneway_merge(const struct cache_entry
* const *src
,
135 struct unpack_trees_options
*o
);
136 int stash_worktree_untracked_merge(const struct cache_entry
* const *src
,
137 struct unpack_trees_options
*o
);