1#ifndef UNPACK_TREES_H
2#define UNPACK_TREES_H
34
#include "tree-walk.h"
5#include "string-list.h"
67
#define MAX_UNPACK_TREES 8
89
struct unpack_trees_options;
10struct exclude_list;
1112
typedef int (*merge_fn_t)(const struct cache_entry * const *src,
13struct unpack_trees_options *options);
1415
enum unpack_trees_error_types {
16ERROR_WOULD_OVERWRITE = 0,
17ERROR_NOT_UPTODATE_FILE,
18ERROR_NOT_UPTODATE_DIR,
19ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN,
20ERROR_WOULD_LOSE_UNTRACKED_REMOVED,
21ERROR_BIND_OVERLAP,
22ERROR_SPARSE_NOT_UPTODATE_FILE,
23ERROR_WOULD_LOSE_ORPHANED_OVERWRITTEN,
24ERROR_WOULD_LOSE_ORPHANED_REMOVED,
25ERROR_WOULD_LOSE_SUBMODULE,
26NB_UNPACK_TREES_ERROR_TYPES
27};
2829
/*
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.
32*/
33void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
34const char *cmd);
3536
struct unpack_trees_options {
37unsigned int reset,
38merge,
39update,
40index_only,
41nontrivial_merge,
42trivial_merges_only,
43verbose_update,
44aggressive,
45skip_unmerged,
46initial_checkout,
47diff_index_cached,
48debug_unpack,
49skip_sparse_checkout,
50gently,
51exiting_early,
52show_all_errors,
53dry_run;
54const char *prefix;
55int cache_bottom;
56struct dir_struct *dir;
57struct pathspec *pathspec;
58merge_fn_t fn;
59const char *msgs[NB_UNPACK_TREES_ERROR_TYPES];
60/*
61* Store error messages in an array, each case
62* corresponding to a error message type
63*/
64struct string_list unpack_rejects[NB_UNPACK_TREES_ERROR_TYPES];
6566
int head_idx;
67int merge_size;
6869
struct cache_entry *df_conflict_entry;
70void *unpack_data;
7172
struct index_state *dst_index;
73struct index_state *src_index;
74struct index_state result;
7576
struct exclude_list *el; /* for internal use */
77};
7879
extern int unpack_trees(unsigned n, struct tree_desc *t,
80struct unpack_trees_options *options);
8182
int verify_uptodate(const struct cache_entry *ce,
83struct unpack_trees_options *o);
8485
int threeway_merge(const struct cache_entry * const *stages,
86struct unpack_trees_options *o);
87int twoway_merge(const struct cache_entry * const *src,
88struct unpack_trees_options *o);
89int bind_merge(const struct cache_entry * const *src,
90struct unpack_trees_options *o);
91int oneway_merge(const struct cache_entry * const *src,
92struct unpack_trees_options *o);
9394
#endif