Merge branch 'jk/unavailable-can-be-missing'
[git.git] / unpack-trees.h
blob41178ada94a4b7c5222cab7dd17d9eeb7a1956e4
1 #ifndef UNPACK_TREES_H
2 #define UNPACK_TREES_H
4 #include "tree-walk.h"
5 #include "string-list.h"
7 #define MAX_UNPACK_TREES 8
9 struct unpack_trees_options;
10 struct exclude_list;
12 typedef int (*merge_fn_t)(const struct cache_entry * const *src,
13 struct unpack_trees_options *options);
15 enum unpack_trees_error_types {
16 ERROR_WOULD_OVERWRITE = 0,
17 ERROR_NOT_UPTODATE_FILE,
18 ERROR_NOT_UPTODATE_DIR,
19 ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN,
20 ERROR_WOULD_LOSE_UNTRACKED_REMOVED,
21 ERROR_BIND_OVERLAP,
22 ERROR_SPARSE_NOT_UPTODATE_FILE,
23 ERROR_WOULD_LOSE_ORPHANED_OVERWRITTEN,
24 ERROR_WOULD_LOSE_ORPHANED_REMOVED,
25 ERROR_WOULD_LOSE_SUBMODULE,
26 NB_UNPACK_TREES_ERROR_TYPES
30 * Sets the list of user-friendly error messages to be used by the
31 * command "cmd" (either merge or checkout), and show_all_errors to 1.
33 void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
34 const char *cmd);
36 struct unpack_trees_options {
37 unsigned int reset,
38 merge,
39 update,
40 index_only,
41 nontrivial_merge,
42 trivial_merges_only,
43 verbose_update,
44 aggressive,
45 skip_unmerged,
46 initial_checkout,
47 diff_index_cached,
48 debug_unpack,
49 skip_sparse_checkout,
50 gently,
51 exiting_early,
52 show_all_errors,
53 dry_run;
54 const char *prefix;
55 int cache_bottom;
56 struct dir_struct *dir;
57 struct pathspec *pathspec;
58 merge_fn_t fn;
59 const char *msgs[NB_UNPACK_TREES_ERROR_TYPES];
61 * Store error messages in an array, each case
62 * corresponding to a error message type
64 struct string_list unpack_rejects[NB_UNPACK_TREES_ERROR_TYPES];
66 int head_idx;
67 int merge_size;
69 struct cache_entry *df_conflict_entry;
70 void *unpack_data;
72 struct index_state *dst_index;
73 struct index_state *src_index;
74 struct index_state result;
76 struct exclude_list *el; /* for internal use */
79 extern int unpack_trees(unsigned n, struct tree_desc *t,
80 struct unpack_trees_options *options);
82 int verify_uptodate(const struct cache_entry *ce,
83 struct unpack_trees_options *o);
85 int threeway_merge(const struct cache_entry * const *stages,
86 struct unpack_trees_options *o);
87 int twoway_merge(const struct cache_entry * const *src,
88 struct unpack_trees_options *o);
89 int bind_merge(const struct cache_entry * const *src,
90 struct unpack_trees_options *o);
91 int oneway_merge(const struct cache_entry * const *src,
92 struct unpack_trees_options *o);
94 #endif