]> git.ipfire.org Git - thirdparty/git.git/blame - unpack-trees.h
unpack-trees: simplify verify_absent_sparse()
[thirdparty/git.git] / unpack-trees.h
CommitLineData
16da134b
JS
1#ifndef UNPACK_TREES_H
2#define UNPACK_TREES_H
3
ef3ca954 4#include "cache.h"
1c41d280 5#include "argv-array.h"
ef3ca954
EN
6#include "string-list.h"
7#include "tree-walk.h"
7980872d 8
5290d451 9#define MAX_UNPACK_TREES MAX_TRAVERSE_TREES
ca885a4f 10
ef3ca954 11struct cache_entry;
16da134b 12struct unpack_trees_options;
caa3d554 13struct pattern_list;
16da134b 14
5828e835 15typedef int (*merge_fn_t)(const struct cache_entry * const *src,
34110cd4 16 struct unpack_trees_options *options);
16da134b 17
08353ebb
MM
18enum unpack_trees_error_types {
19 ERROR_WOULD_OVERWRITE = 0,
20 ERROR_NOT_UPTODATE_FILE,
21 ERROR_NOT_UPTODATE_DIR,
08402b04
MM
22 ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN,
23 ERROR_WOULD_LOSE_UNTRACKED_REMOVED,
08353ebb
MM
24 ERROR_BIND_OVERLAP,
25 ERROR_SPARSE_NOT_UPTODATE_FILE,
08402b04 26 ERROR_WOULD_LOSE_ORPHANED_OVERWRITTEN,
a7bc845a 27 ERROR_WOULD_LOSE_SUBMODULE,
08353ebb 28 NB_UNPACK_TREES_ERROR_TYPES
8ccba008
JH
29};
30
dc1166e6
MM
31/*
32 * Sets the list of user-friendly error messages to be used by the
5e65ee35 33 * command "cmd" (either merge or checkout), and show_all_errors to 1.
dc1166e6 34 */
e294030f
MM
35void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
36 const char *cmd);
dc1166e6 37
1c41d280
38/*
39 * Frees resources allocated by setup_unpack_trees_porcelain().
40 */
41void clear_unpack_trees_porcelain(struct unpack_trees_options *opts);
42
16da134b 43struct unpack_trees_options {
5a56da58
SB
44 unsigned int reset,
45 merge,
46 update,
b878579a 47 clone,
5a56da58
SB
48 index_only,
49 nontrivial_merge,
50 trivial_merges_only,
51 verbose_update,
52 aggressive,
53 skip_unmerged,
54 initial_checkout,
55 diff_index_cached,
ba655da5 56 debug_unpack,
08aefc9e 57 skip_sparse_checkout,
b165fac8 58 quiet,
b4194828 59 exiting_early,
2c9078d0 60 show_all_errors,
e091228e
DS
61 dry_run,
62 keep_pattern_list;
16da134b 63 const char *prefix;
da165f47 64 int cache_bottom;
f8a9d428 65 struct dir_struct *dir;
40e37256 66 struct pathspec *pathspec;
16da134b 67 merge_fn_t fn;
08353ebb 68 const char *msgs[NB_UNPACK_TREES_ERROR_TYPES];
1c41d280 69 struct argv_array msgs_to_free;
e6c111b4
MM
70 /*
71 * Store error messages in an array, each case
72 * corresponding to a error message type
73 */
7980872d 74 struct string_list unpack_rejects[NB_UNPACK_TREES_ERROR_TYPES];
16da134b
JS
75
76 int head_idx;
77 int merge_size;
78
79 struct cache_entry *df_conflict_entry;
d1f2d7e8 80 void *unpack_data;
34110cd4
LT
81
82 struct index_state *dst_index;
32260ad5 83 struct index_state *src_index;
34110cd4 84 struct index_state result;
08aefc9e 85
caa3d554 86 struct pattern_list *pl; /* for internal use */
16da134b
JS
87};
88
340f4bc9
NTND
89int unpack_trees(unsigned n, struct tree_desc *t,
90 struct unpack_trees_options *options);
16da134b 91
64b1abe9
EN
92int verify_uptodate(const struct cache_entry *ce,
93 struct unpack_trees_options *o);
94
5828e835
RS
95int threeway_merge(const struct cache_entry * const *stages,
96 struct unpack_trees_options *o);
97int twoway_merge(const struct cache_entry * const *src,
98 struct unpack_trees_options *o);
99int bind_merge(const struct cache_entry * const *src,
100 struct unpack_trees_options *o);
101int oneway_merge(const struct cache_entry * const *src,
102 struct unpack_trees_options *o);
076b0adc 103
16da134b 104#endif