trace2: refactor to avoid gcc warning under -O3
[git/debian.git] / unpack-trees.h
blobd344d7d29694dbf64d6874163810e65915167fd8
1 #ifndef UNPACK_TREES_H
2 #define UNPACK_TREES_H
4 #include "cache.h"
5 #include "argv-array.h"
6 #include "string-list.h"
7 #include "tree-walk.h"
9 #define MAX_UNPACK_TREES 8
11 struct cache_entry;
12 struct unpack_trees_options;
13 struct exclude_list;
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,
24 ERROR_BIND_OVERLAP,
25 ERROR_SPARSE_NOT_UPTODATE_FILE,
26 ERROR_WOULD_LOSE_ORPHANED_OVERWRITTEN,
27 ERROR_WOULD_LOSE_ORPHANED_REMOVED,
28 ERROR_WOULD_LOSE_SUBMODULE,
29 NB_UNPACK_TREES_ERROR_TYPES
33 * Sets the list of user-friendly error messages to be used by the
34 * command "cmd" (either merge or checkout), and show_all_errors to 1.
36 void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
37 const char *cmd);
40 * Frees resources allocated by setup_unpack_trees_porcelain().
42 void clear_unpack_trees_porcelain(struct unpack_trees_options *opts);
44 struct unpack_trees_options {
45 unsigned int reset,
46 merge,
47 update,
48 clone,
49 index_only,
50 nontrivial_merge,
51 trivial_merges_only,
52 verbose_update,
53 aggressive,
54 skip_unmerged,
55 initial_checkout,
56 diff_index_cached,
57 debug_unpack,
58 skip_sparse_checkout,
59 quiet,
60 exiting_early,
61 show_all_errors,
62 dry_run;
63 const char *prefix;
64 int cache_bottom;
65 struct dir_struct *dir;
66 struct pathspec *pathspec;
67 merge_fn_t fn;
68 const char *msgs[NB_UNPACK_TREES_ERROR_TYPES];
69 struct argv_array msgs_to_free;
71 * Store error messages in an array, each case
72 * corresponding to a error message type
74 struct string_list unpack_rejects[NB_UNPACK_TREES_ERROR_TYPES];
76 int head_idx;
77 int merge_size;
79 struct cache_entry *df_conflict_entry;
80 void *unpack_data;
82 struct index_state *dst_index;
83 struct index_state *src_index;
84 struct index_state result;
86 struct exclude_list *el; /* for internal use */
89 int unpack_trees(unsigned n, struct tree_desc *t,
90 struct unpack_trees_options *options);
92 int verify_uptodate(const struct cache_entry *ce,
93 struct unpack_trees_options *o);
95 int threeway_merge(const struct cache_entry * const *stages,
96 struct unpack_trees_options *o);
97 int twoway_merge(const struct cache_entry * const *src,
98 struct unpack_trees_options *o);
99 int bind_merge(const struct cache_entry * const *src,
100 struct unpack_trees_options *o);
101 int oneway_merge(const struct cache_entry * const *src,
102 struct unpack_trees_options *o);
104 #endif