#define USE_THE_REPOSITORY_VARIABLE
#include "git-compat-util.h"
#include "advice.h"
#include "strvec.h"
#include "repository.h"
#include "parse.h"
#include "dir.h"
#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "name-hash.h"
#include "tree.h"
#include "tree-walk.h"
#include "cache-tree.h"
#include "unpack-trees.h"
#include "progress.h"
#include "refs.h"
#include "attr.h"
#include "read-cache.h"
#include "split-index.h"
#include "sparse-index.h"
#include "submodule.h"
#include "submodule-config.h"
#include "symlinks.h"
#include "trace2.h"
#include "fsmonitor.h"
#include "object-store-ll.h"
#include "promisor-remote.h"
#include "entry.h"
#include "parallel-checkout.h"
#include "setup.h"
static const char *unpack_plumbing_errors[NB_UNPACK_TREES_WARNING_TYPES] = …;
#define ERRORMSG(o,type) …
static const char *super_prefixed(const char *path, const char *super_prefix)
{ … }
void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
const char *cmd)
{ … }
void clear_unpack_trees_porcelain(struct unpack_trees_options *opts)
{ … }
static int do_add_entry(struct unpack_trees_options *o, struct cache_entry *ce,
unsigned int set, unsigned int clear)
{ … }
static void add_entry(struct unpack_trees_options *o,
const struct cache_entry *ce,
unsigned int set, unsigned int clear)
{ … }
static int add_rejected_path(struct unpack_trees_options *o,
enum unpack_trees_error_types e,
const char *path)
{ … }
static void display_error_msgs(struct unpack_trees_options *o)
{ … }
static void display_warning_msgs(struct unpack_trees_options *o)
{ … }
static int check_submodule_move_head(const struct cache_entry *ce,
const char *old_id,
const char *new_id,
struct unpack_trees_options *o)
{ … }
static void load_gitmodules_file(struct index_state *index,
struct checkout *state)
{ … }
static struct progress *get_progress(struct unpack_trees_options *o,
struct index_state *index)
{ … }
static void setup_collided_checkout_detection(struct checkout *state,
struct index_state *index)
{ … }
static void report_collided_checkout(struct index_state *index)
{ … }
static int must_checkout(const struct cache_entry *ce)
{ … }
static int check_updates(struct unpack_trees_options *o,
struct index_state *index)
{ … }
static int verify_uptodate_sparse(const struct cache_entry *ce,
struct unpack_trees_options *o);
static int verify_absent_sparse(const struct cache_entry *ce,
enum unpack_trees_error_types,
struct unpack_trees_options *o);
static int apply_sparse_checkout(struct index_state *istate,
struct cache_entry *ce,
struct unpack_trees_options *o)
{ … }
static int warn_conflicted_path(struct index_state *istate,
int i,
struct unpack_trees_options *o)
{ … }
static inline int call_unpack_fn(const struct cache_entry * const *src,
struct unpack_trees_options *o)
{ … }
static void mark_ce_used(struct cache_entry *ce, struct unpack_trees_options *o)
{ … }
static void mark_all_ce_unused(struct index_state *index)
{ … }
static int locate_in_src_index(const struct cache_entry *ce,
struct unpack_trees_options *o)
{ … }
static void mark_ce_used_same_name(struct cache_entry *ce,
struct unpack_trees_options *o)
{ … }
static struct cache_entry *next_cache_entry(struct unpack_trees_options *o)
{ … }
static void add_same_unmerged(const struct cache_entry *ce,
struct unpack_trees_options *o)
{ … }
static int unpack_index_entry(struct cache_entry *ce,
struct unpack_trees_options *o)
{ … }
static int find_cache_pos(struct traverse_info *, const char *p, size_t len);
static void restore_cache_bottom(struct traverse_info *info, int bottom)
{ … }
static int switch_cache_bottom(struct traverse_info *info)
{ … }
static inline int are_same_oid(struct name_entry *name_j, struct name_entry *name_k)
{ … }
static int all_trees_same_as_cache_tree(int n, unsigned long dirmask,
struct name_entry *names,
struct traverse_info *info)
{ … }
static int index_pos_by_traverse_info(struct name_entry *names,
struct traverse_info *info)
{ … }
static int traverse_by_cache_tree(int pos, int nr_entries, int nr_names,
struct traverse_info *info)
{ … }
static int traverse_trees_recursive(int n, unsigned long dirmask,
unsigned long df_conflicts,
struct name_entry *names,
struct traverse_info *info)
{ … }
static int do_compare_entry_piecewise(const struct cache_entry *ce,
const struct traverse_info *info,
const char *name, size_t namelen,
unsigned mode)
{ … }
static int do_compare_entry(const struct cache_entry *ce,
const struct traverse_info *info,
const char *name, size_t namelen,
unsigned mode)
{ … }
static int compare_entry(const struct cache_entry *ce, const struct traverse_info *info, const struct name_entry *n)
{ … }
static int ce_in_traverse_path(const struct cache_entry *ce,
const struct traverse_info *info)
{ … }
static struct cache_entry *create_ce_entry(const struct traverse_info *info,
const struct name_entry *n,
int stage,
struct index_state *istate,
int is_transient,
int is_sparse_directory)
{ … }
static int entry_is_new_sparse_dir(const struct traverse_info *info,
const struct name_entry *p)
{ … }
static int unpack_single_entry(int n, unsigned long mask,
unsigned long dirmask,
struct cache_entry **src,
const struct name_entry *names,
const struct traverse_info *info,
int *is_new_sparse_dir)
{ … }
static int unpack_failed(struct unpack_trees_options *o, const char *message)
{ … }
static int find_cache_pos(struct traverse_info *info,
const char *p, size_t p_len)
{ … }
static int sparse_dir_matches_path(const struct cache_entry *ce,
struct traverse_info *info,
const struct name_entry *p)
{ … }
static struct cache_entry *find_cache_entry(struct traverse_info *info,
const struct name_entry *p)
{ … }
static void debug_path(struct traverse_info *info)
{ … }
static void debug_name_entry(int i, struct name_entry *n)
{ … }
static void debug_unpack_callback(int n,
unsigned long mask,
unsigned long dirmask,
struct name_entry *names,
struct traverse_info *info)
{ … }
static int is_sparse_directory_entry(struct cache_entry *ce,
const struct name_entry *name,
struct traverse_info *info)
{ … }
static int unpack_sparse_callback(int n, unsigned long mask, unsigned long dirmask, struct name_entry *names, struct traverse_info *info)
{ … }
static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, struct name_entry *names, struct traverse_info *info)
{ … }
static int clear_ce_flags_1(struct index_state *istate,
struct cache_entry **cache, int nr,
struct strbuf *prefix,
int select_mask, int clear_mask,
struct pattern_list *pl,
enum pattern_match_result default_match,
int progress_nr);
static int clear_ce_flags_dir(struct index_state *istate,
struct cache_entry **cache, int nr,
struct strbuf *prefix,
char *basename,
int select_mask, int clear_mask,
struct pattern_list *pl,
enum pattern_match_result default_match,
int progress_nr)
{ … }
static int clear_ce_flags_1(struct index_state *istate,
struct cache_entry **cache, int nr,
struct strbuf *prefix,
int select_mask, int clear_mask,
struct pattern_list *pl,
enum pattern_match_result default_match,
int progress_nr)
{ … }
static int clear_ce_flags(struct index_state *istate,
int select_mask, int clear_mask,
struct pattern_list *pl,
int show_progress)
{ … }
static void mark_new_skip_worktree(struct pattern_list *pl,
struct index_state *istate,
int select_flag, int skip_wt_flag,
int show_progress)
{ … }
static void populate_from_existing_patterns(struct unpack_trees_options *o,
struct pattern_list *pl)
{ … }
static void update_sparsity_for_prefix(const char *prefix,
struct index_state *istate)
{ … }
static int verify_absent(const struct cache_entry *,
enum unpack_trees_error_types,
struct unpack_trees_options *);
int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options *o)
{ … }
enum update_sparsity_result update_sparsity(struct unpack_trees_options *o,
struct pattern_list *pl)
{ … }
static int reject_merge(const struct cache_entry *ce,
struct unpack_trees_options *o)
{ … }
static int same(const struct cache_entry *a, const struct cache_entry *b)
{ … }
static int verify_uptodate_1(const struct cache_entry *ce,
struct unpack_trees_options *o,
enum unpack_trees_error_types error_type)
{ … }
int verify_uptodate(const struct cache_entry *ce,
struct unpack_trees_options *o)
{ … }
static int verify_uptodate_sparse(const struct cache_entry *ce,
struct unpack_trees_options *o)
{ … }
static void invalidate_ce_path(const struct cache_entry *ce,
struct unpack_trees_options *o)
{ … }
static int verify_clean_submodule(const char *old_sha1,
const struct cache_entry *ce,
struct unpack_trees_options *o)
{ … }
static int verify_clean_subdirectory(const struct cache_entry *ce,
struct unpack_trees_options *o)
{ … }
static int icase_exists(struct unpack_trees_options *o, const char *name, int len, struct stat *st)
{ … }
enum absent_checking_type { … };
static int check_ok_to_remove(const char *name, int len, int dtype,
const struct cache_entry *ce, struct stat *st,
enum unpack_trees_error_types error_type,
enum absent_checking_type absent_type,
struct unpack_trees_options *o)
{ … }
static int verify_absent_1(const struct cache_entry *ce,
enum unpack_trees_error_types error_type,
enum absent_checking_type absent_type,
struct unpack_trees_options *o)
{ … }
static int verify_absent(const struct cache_entry *ce,
enum unpack_trees_error_types error_type,
struct unpack_trees_options *o)
{ … }
static int verify_absent_if_directory(const struct cache_entry *ce,
enum unpack_trees_error_types error_type,
struct unpack_trees_options *o)
{ … }
static int verify_absent_sparse(const struct cache_entry *ce,
enum unpack_trees_error_types error_type,
struct unpack_trees_options *o)
{ … }
static int merged_entry(const struct cache_entry *ce,
const struct cache_entry *old,
struct unpack_trees_options *o)
{ … }
static int merged_sparse_dir(const struct cache_entry * const *src, int n,
struct unpack_trees_options *o)
{ … }
static int deleted_entry(const struct cache_entry *ce,
const struct cache_entry *old,
struct unpack_trees_options *o)
{ … }
static int keep_entry(const struct cache_entry *ce,
struct unpack_trees_options *o)
{ … }
#if DBRT_DEBUG
static void show_stage_entry(FILE *o,
const char *label, const struct cache_entry *ce)
{
if (!ce)
fprintf(o, "%s (missing)\n", label);
else
fprintf(o, "%s%06o %s %d\t%s\n",
label,
ce->ce_mode,
oid_to_hex(&ce->oid),
ce_stage(ce),
ce->name);
}
#endif
int threeway_merge(const struct cache_entry * const *stages,
struct unpack_trees_options *o)
{ … }
int twoway_merge(const struct cache_entry * const *src,
struct unpack_trees_options *o)
{ … }
int bind_merge(const struct cache_entry * const *src,
struct unpack_trees_options *o)
{ … }
int oneway_merge(const struct cache_entry * const *src,
struct unpack_trees_options *o)
{ … }
int stash_worktree_untracked_merge(const struct cache_entry * const *src,
struct unpack_trees_options *o)
{ … }