unpack-trees.hon commit t/lib-git-daemon: fix signal checking (4c2eb06)
   1#ifndef UNPACK_TREES_H
   2#define UNPACK_TREES_H
   3
   4#include "tree-walk.h"
   5#include "argv-array.h"
   6
   7#define MAX_UNPACK_TREES 8
   8
   9struct unpack_trees_options;
  10struct exclude_list;
  11
  12typedef int (*merge_fn_t)(const struct cache_entry * const *src,
  13                struct unpack_trees_options *options);
  14
  15enum unpack_trees_error_types {
  16        ERROR_WOULD_OVERWRITE = 0,
  17        ERROR_NOT_UPTODATE_FILE,
  18        ERROR_NOT_UPTODATE_DIR,
  19        ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN,
  20        ERROR_WOULD_LOSE_UNTRACKED_REMOVED,
  21        ERROR_BIND_OVERLAP,
  22        ERROR_SPARSE_NOT_UPTODATE_FILE,
  23        ERROR_WOULD_LOSE_ORPHANED_OVERWRITTEN,
  24        ERROR_WOULD_LOSE_ORPHANED_REMOVED,
  25        ERROR_WOULD_LOSE_SUBMODULE,
  26        NB_UNPACK_TREES_ERROR_TYPES
  27};
  28
  29/*
  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,
  34                                  const char *cmd);
  35
  36/*
  37 * Frees resources allocated by setup_unpack_trees_porcelain().
  38 */
  39void clear_unpack_trees_porcelain(struct unpack_trees_options *opts);
  40
  41struct unpack_trees_options {
  42        unsigned int reset,
  43                     merge,
  44                     update,
  45                     index_only,
  46                     nontrivial_merge,
  47                     trivial_merges_only,
  48                     verbose_update,
  49                     aggressive,
  50                     skip_unmerged,
  51                     initial_checkout,
  52                     diff_index_cached,
  53                     debug_unpack,
  54                     skip_sparse_checkout,
  55                     gently,
  56                     exiting_early,
  57                     show_all_errors,
  58                     dry_run;
  59        const char *prefix;
  60        int cache_bottom;
  61        struct dir_struct *dir;
  62        struct pathspec *pathspec;
  63        merge_fn_t fn;
  64        const char *msgs[NB_UNPACK_TREES_ERROR_TYPES];
  65        struct argv_array msgs_to_free;
  66        /*
  67         * Store error messages in an array, each case
  68         * corresponding to a error message type
  69         */
  70        struct string_list unpack_rejects[NB_UNPACK_TREES_ERROR_TYPES];
  71
  72        int head_idx;
  73        int merge_size;
  74
  75        struct cache_entry *df_conflict_entry;
  76        void *unpack_data;
  77
  78        struct index_state *dst_index;
  79        struct index_state *src_index;
  80        struct index_state result;
  81
  82        struct exclude_list *el; /* for internal use */
  83};
  84
  85extern int unpack_trees(unsigned n, struct tree_desc *t,
  86                struct unpack_trees_options *options);
  87
  88int verify_uptodate(const struct cache_entry *ce,
  89                    struct unpack_trees_options *o);
  90
  91int threeway_merge(const struct cache_entry * const *stages,
  92                   struct unpack_trees_options *o);
  93int twoway_merge(const struct cache_entry * const *src,
  94                 struct unpack_trees_options *o);
  95int bind_merge(const struct cache_entry * const *src,
  96               struct unpack_trees_options *o);
  97int oneway_merge(const struct cache_entry * const *src,
  98                 struct unpack_trees_options *o);
  99
 100#endif