5 #include "argv-array.h"
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
,
22 ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN
,
23 ERROR_WOULD_LOSE_UNTRACKED_REMOVED
,
25 ERROR_WOULD_LOSE_SUBMODULE
,
27 NB_UNPACK_TREES_ERROR_TYPES
,
29 WARNING_SPARSE_NOT_UPTODATE_FILE
,
30 WARNING_SPARSE_ORPHANED_NOT_OVERWRITTEN
,
32 NB_UNPACK_TREES_WARNING_TYPES
,
36 * Sets the list of user-friendly error messages to be used by the
37 * command "cmd" (either merge or checkout), and show_all_errors to 1.
39 void setup_unpack_trees_porcelain(struct unpack_trees_options
*opts
,
43 * Frees resources allocated by setup_unpack_trees_porcelain().
45 void clear_unpack_trees_porcelain(struct unpack_trees_options
*opts
);
47 struct unpack_trees_options
{
68 struct dir_struct
*dir
;
69 struct pathspec
*pathspec
;
71 const char *msgs
[NB_UNPACK_TREES_WARNING_TYPES
];
72 struct argv_array msgs_to_free
;
74 * Store error messages in an array, each case
75 * corresponding to a error message type
77 struct string_list unpack_rejects
[NB_UNPACK_TREES_WARNING_TYPES
];
82 struct cache_entry
*df_conflict_entry
;
85 struct index_state
*dst_index
;
86 struct index_state
*src_index
;
87 struct index_state result
;
89 struct pattern_list
*pl
; /* for internal use */
92 int unpack_trees(unsigned n
, struct tree_desc
*t
,
93 struct unpack_trees_options
*options
);
95 enum update_sparsity_result
{
96 UPDATE_SPARSITY_SUCCESS
= 0,
97 UPDATE_SPARSITY_WARNINGS
= 1,
98 UPDATE_SPARSITY_INDEX_UPDATE_FAILURES
= -1,
99 UPDATE_SPARSITY_WORKTREE_UPDATE_FAILURES
= -2
102 enum update_sparsity_result
update_sparsity(struct unpack_trees_options
*options
);
104 int verify_uptodate(const struct cache_entry
*ce
,
105 struct unpack_trees_options
*o
);
107 int threeway_merge(const struct cache_entry
* const *stages
,
108 struct unpack_trees_options
*o
);
109 int twoway_merge(const struct cache_entry
* const *src
,
110 struct unpack_trees_options
*o
);
111 int bind_merge(const struct cache_entry
* const *src
,
112 struct unpack_trees_options
*o
);
113 int oneway_merge(const struct cache_entry
* const *src
,
114 struct unpack_trees_options
*o
);