unpack-trees.hon commit Merge branch 'jc/apply-blank-at-eof-fix' into maint (e63f87a)
   1#ifndef UNPACK_TREES_H
   2#define UNPACK_TREES_H
   3
   4#include "string-list.h"
   5
   6#define MAX_UNPACK_TREES 8
   7
   8struct unpack_trees_options;
   9struct exclude_list;
  10
  11typedef int (*merge_fn_t)(struct cache_entry **src,
  12                struct unpack_trees_options *options);
  13
  14enum unpack_trees_error_types {
  15        ERROR_WOULD_OVERWRITE = 0,
  16        ERROR_NOT_UPTODATE_FILE,
  17        ERROR_NOT_UPTODATE_DIR,
  18        ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN,
  19        ERROR_WOULD_LOSE_UNTRACKED_REMOVED,
  20        ERROR_BIND_OVERLAP,
  21        ERROR_SPARSE_NOT_UPTODATE_FILE,
  22        ERROR_WOULD_LOSE_ORPHANED_OVERWRITTEN,
  23        ERROR_WOULD_LOSE_ORPHANED_REMOVED,
  24        NB_UNPACK_TREES_ERROR_TYPES
  25};
  26
  27/*
  28 * Sets the list of user-friendly error messages to be used by the
  29 * command "cmd" (either merge or checkout), and show_all_errors to 1.
  30 */
  31void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
  32                                  const char *cmd);
  33
  34struct unpack_trees_options {
  35        unsigned int reset,
  36                     merge,
  37                     update,
  38                     index_only,
  39                     nontrivial_merge,
  40                     trivial_merges_only,
  41                     verbose_update,
  42                     aggressive,
  43                     skip_unmerged,
  44                     initial_checkout,
  45                     diff_index_cached,
  46                     debug_unpack,
  47                     skip_sparse_checkout,
  48                     gently,
  49                     exiting_early,
  50                     show_all_errors,
  51                     dry_run;
  52        const char *prefix;
  53        int cache_bottom;
  54        struct dir_struct *dir;
  55        struct pathspec *pathspec;
  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 string_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