fetch: pass --no-write-fetch-head to subprocesses
[git/debian.git] / unpack-trees.h
blob3a7b3e5f0077938f1e28de5f41a691191c098744
1 #ifndef UNPACK_TREES_H
2 #define UNPACK_TREES_H
4 #include "cache.h"
5 #include "strvec.h"
6 #include "string-list.h"
7 #include "tree-walk.h"
9 #define MAX_UNPACK_TREES MAX_TRAVERSE_TREES
11 struct cache_entry;
12 struct unpack_trees_options;
13 struct pattern_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_CWD_IN_THE_WAY,
23 ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN,
24 ERROR_WOULD_LOSE_UNTRACKED_REMOVED,
25 ERROR_BIND_OVERLAP,
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,
42 const char *cmd);
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 {
57 unsigned int merge,
58 update,
59 preserve_ignored,
60 clone,
61 index_only,
62 nontrivial_merge,
63 trivial_merges_only,
64 verbose_update,
65 aggressive,
66 skip_unmerged,
67 initial_checkout,
68 diff_index_cached,
69 debug_unpack,
70 skip_sparse_checkout,
71 quiet,
72 exiting_early,
73 show_all_errors,
74 dry_run,
75 skip_cache_tree_update;
76 enum unpack_trees_reset_type reset;
77 const char *prefix;
78 const char *super_prefix;
79 int cache_bottom;
80 struct pathspec *pathspec;
81 merge_fn_t fn;
82 const char *msgs[NB_UNPACK_TREES_WARNING_TYPES];
83 struct strvec msgs_to_free;
85 * Store error messages in an array, each case
86 * corresponding to a error message type
88 struct string_list unpack_rejects[NB_UNPACK_TREES_WARNING_TYPES];
90 int head_idx;
91 int merge_size;
93 struct cache_entry *df_conflict_entry;
94 void *unpack_data;
96 struct index_state *dst_index;
97 struct index_state *src_index;
98 struct index_state result;
100 struct pattern_list *pl; /* for internal use */
101 struct dir_struct *dir; /* for internal use only */
102 struct checkout_metadata meta;
105 int unpack_trees(unsigned n, struct tree_desc *t,
106 struct unpack_trees_options *options);
108 enum update_sparsity_result {
109 UPDATE_SPARSITY_SUCCESS = 0,
110 UPDATE_SPARSITY_WARNINGS = 1,
111 UPDATE_SPARSITY_INDEX_UPDATE_FAILURES = -1,
112 UPDATE_SPARSITY_WORKTREE_UPDATE_FAILURES = -2
115 enum update_sparsity_result update_sparsity(struct unpack_trees_options *options);
117 int verify_uptodate(const struct cache_entry *ce,
118 struct unpack_trees_options *o);
120 int threeway_merge(const struct cache_entry * const *stages,
121 struct unpack_trees_options *o);
122 int twoway_merge(const struct cache_entry * const *src,
123 struct unpack_trees_options *o);
124 int bind_merge(const struct cache_entry * const *src,
125 struct unpack_trees_options *o);
126 int oneway_merge(const struct cache_entry * const *src,
127 struct unpack_trees_options *o);
128 int stash_worktree_untracked_merge(const struct cache_entry * const *src,
129 struct unpack_trees_options *o);
131 #endif