unpack-trees.hon commit merge-recursive: Move rename/delete handling into dedicated function (6ef2cb0)
   1#ifndef UNPACK_TREES_H
   2#define UNPACK_TREES_H
   3
   4#define MAX_UNPACK_TREES 8
   5
   6struct unpack_trees_options;
   7struct exclude_list;
   8
   9typedef int (*merge_fn_t)(struct cache_entry **src,
  10                struct unpack_trees_options *options);
  11
  12enum unpack_trees_error_types {
  13        ERROR_WOULD_OVERWRITE = 0,
  14        ERROR_NOT_UPTODATE_FILE,
  15        ERROR_NOT_UPTODATE_DIR,
  16        ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN,
  17        ERROR_WOULD_LOSE_UNTRACKED_REMOVED,
  18        ERROR_BIND_OVERLAP,
  19        ERROR_SPARSE_NOT_UPTODATE_FILE,
  20        ERROR_WOULD_LOSE_ORPHANED_OVERWRITTEN,
  21        ERROR_WOULD_LOSE_ORPHANED_REMOVED,
  22        NB_UNPACK_TREES_ERROR_TYPES
  23};
  24
  25/*
  26 * Sets the list of user-friendly error messages to be used by the
  27 * command "cmd" (either merge or checkout), and show_all_errors to 1.
  28 */
  29void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
  30                                  const char *cmd);
  31
  32struct rejected_paths_list {
  33        char *path;
  34        struct rejected_paths_list *next;
  35};
  36
  37struct unpack_trees_options {
  38        unsigned int reset,
  39                     merge,
  40                     update,
  41                     index_only,
  42                     nontrivial_merge,
  43                     trivial_merges_only,
  44                     verbose_update,
  45                     aggressive,
  46                     skip_unmerged,
  47                     initial_checkout,
  48                     diff_index_cached,
  49                     debug_unpack,
  50                     skip_sparse_checkout,
  51                     gently,
  52                     show_all_errors;
  53        const char *prefix;
  54        int cache_bottom;
  55        struct dir_struct *dir;
  56        merge_fn_t fn;
  57        const char *msgs[NB_UNPACK_TREES_ERROR_TYPES];
  58        /*
  59         * Store error messages in an array, each case
  60         * corresponding to a error message type
  61         */
  62        struct rejected_paths_list *unpack_rejects[NB_UNPACK_TREES_ERROR_TYPES];
  63
  64        int head_idx;
  65        int merge_size;
  66
  67        struct cache_entry *df_conflict_entry;
  68        void *unpack_data;
  69
  70        struct index_state *dst_index;
  71        struct index_state *src_index;
  72        struct index_state result;
  73
  74        struct exclude_list *el; /* for internal use */
  75};
  76
  77extern int unpack_trees(unsigned n, struct tree_desc *t,
  78                struct unpack_trees_options *options);
  79
  80int threeway_merge(struct cache_entry **stages, struct unpack_trees_options *o);
  81int twoway_merge(struct cache_entry **src, struct unpack_trees_options *o);
  82int bind_merge(struct cache_entry **src, struct unpack_trees_options *o);
  83int oneway_merge(struct cache_entry **src, struct unpack_trees_options *o);
  84
  85#endif