#define USE_THE_REPOSITORY_VARIABLE
#include "git-compat-util.h"
#include "bulk-checkin.h"
#include "config.h"
#include "date.h"
#include "diff.h"
#include "diffcore.h"
#include "hex.h"
#include "tempfile.h"
#include "lockfile.h"
#include "cache-tree.h"
#include "refs.h"
#include "dir.h"
#include "object-file.h"
#include "object-store-ll.h"
#include "oid-array.h"
#include "tree.h"
#include "commit.h"
#include "environment.h"
#include "gettext.h"
#include "mem-pool.h"
#include "name-hash.h"
#include "object-name.h"
#include "path.h"
#include "preload-index.h"
#include "read-cache.h"
#include "repository.h"
#include "resolve-undo.h"
#include "revision.h"
#include "strbuf.h"
#include "trace2.h"
#include "varint.h"
#include "split-index.h"
#include "symlinks.h"
#include "utf8.h"
#include "fsmonitor.h"
#include "thread-utils.h"
#include "progress.h"
#include "sparse-index.h"
#include "csum-file.h"
#include "promisor-remote.h"
#include "hook.h"
#define CE_NAMEMASK …
#define CACHE_EXT(s) …
#define CACHE_EXT_TREE …
#define CACHE_EXT_RESOLVE_UNDO …
#define CACHE_EXT_LINK …
#define CACHE_EXT_UNTRACKED …
#define CACHE_EXT_FSMONITOR …
#define CACHE_EXT_ENDOFINDEXENTRIES …
#define CACHE_EXT_INDEXENTRYOFFSETTABLE …
#define CACHE_EXT_SPARSE_DIRECTORIES …
#define EXTMASK …
#define CACHE_ENTRY_PATH_LENGTH …
enum index_search_mode { … };
static inline struct cache_entry *mem_pool__ce_alloc(struct mem_pool *mem_pool, size_t len)
{ … }
static inline struct cache_entry *mem_pool__ce_calloc(struct mem_pool *mem_pool, size_t len)
{ … }
static struct mem_pool *find_mem_pool(struct index_state *istate)
{ … }
static const char *alternate_index_output;
static void set_index_entry(struct index_state *istate, int nr, struct cache_entry *ce)
{ … }
static void replace_index_entry(struct index_state *istate, int nr, struct cache_entry *ce)
{ … }
void rename_index_entry_at(struct index_state *istate, int nr, const char *new_name)
{ … }
void fill_stat_cache_info(struct index_state *istate, struct cache_entry *ce, struct stat *st)
{ … }
static unsigned int st_mode_from_ce(const struct cache_entry *ce)
{ … }
int fake_lstat(const struct cache_entry *ce, struct stat *st)
{ … }
static int ce_compare_data(struct index_state *istate,
const struct cache_entry *ce,
struct stat *st)
{ … }
static int ce_compare_link(const struct cache_entry *ce, size_t expected_size)
{ … }
static int ce_compare_gitlink(const struct cache_entry *ce)
{ … }
static int ce_modified_check_fs(struct index_state *istate,
const struct cache_entry *ce,
struct stat *st)
{ … }
static int ce_match_stat_basic(const struct cache_entry *ce, struct stat *st)
{ … }
static int is_racy_stat(const struct index_state *istate,
const struct stat_data *sd)
{ … }
int is_racy_timestamp(const struct index_state *istate,
const struct cache_entry *ce)
{ … }
int match_stat_data_racy(const struct index_state *istate,
const struct stat_data *sd, struct stat *st)
{ … }
int ie_match_stat(struct index_state *istate,
const struct cache_entry *ce, struct stat *st,
unsigned int options)
{ … }
int ie_modified(struct index_state *istate,
const struct cache_entry *ce,
struct stat *st, unsigned int options)
{ … }
static int cache_name_stage_compare(const char *name1, int len1, int stage1,
const char *name2, int len2, int stage2)
{ … }
int cmp_cache_name_compare(const void *a_, const void *b_)
{ … }
static int index_name_stage_pos(struct index_state *istate,
const char *name, int namelen,
int stage,
enum index_search_mode search_mode)
{ … }
int index_name_pos(struct index_state *istate, const char *name, int namelen)
{ … }
int index_name_pos_sparse(struct index_state *istate, const char *name, int namelen)
{ … }
int index_entry_exists(struct index_state *istate, const char *name, int namelen)
{ … }
int remove_index_entry_at(struct index_state *istate, int pos)
{ … }
void remove_marked_cache_entries(struct index_state *istate, int invalidate)
{ … }
int remove_file_from_index(struct index_state *istate, const char *path)
{ … }
static int compare_name(struct cache_entry *ce, const char *path, int namelen)
{ … }
static int index_name_pos_also_unmerged(struct index_state *istate,
const char *path, int namelen)
{ … }
static int different_name(struct cache_entry *ce, struct cache_entry *alias)
{ … }
static struct cache_entry *create_alias_ce(struct index_state *istate,
struct cache_entry *ce,
struct cache_entry *alias)
{ … }
void set_object_name_for_intent_to_add_entry(struct cache_entry *ce)
{ … }
int add_to_index(struct index_state *istate, const char *path, struct stat *st, int flags)
{ … }
int add_file_to_index(struct index_state *istate, const char *path, int flags)
{ … }
struct cache_entry *make_empty_cache_entry(struct index_state *istate, size_t len)
{ … }
struct cache_entry *make_empty_transient_cache_entry(size_t len,
struct mem_pool *ce_mem_pool)
{ … }
enum verify_path_result { … };
static enum verify_path_result verify_path_internal(const char *, unsigned);
int verify_path(const char *path, unsigned mode)
{ … }
struct cache_entry *make_cache_entry(struct index_state *istate,
unsigned int mode,
const struct object_id *oid,
const char *path,
int stage,
unsigned int refresh_options)
{ … }
struct cache_entry *make_transient_cache_entry(unsigned int mode,
const struct object_id *oid,
const char *path,
int stage,
struct mem_pool *ce_mem_pool)
{ … }
int chmod_index_entry(struct index_state *istate, struct cache_entry *ce,
char flip)
{ … }
int ce_same_name(const struct cache_entry *a, const struct cache_entry *b)
{ … }
static int verify_dotfile(const char *rest, unsigned mode)
{ … }
static enum verify_path_result verify_path_internal(const char *path,
unsigned mode)
{ … }
static int has_file_name(struct index_state *istate,
const struct cache_entry *ce, int pos, int ok_to_replace)
{ … }
int strcmp_offset(const char *s1, const char *s2, size_t *first_change)
{ … }
static int has_dir_name(struct index_state *istate,
const struct cache_entry *ce, int pos, int ok_to_replace)
{ … }
static int check_file_directory_conflict(struct index_state *istate,
const struct cache_entry *ce,
int pos, int ok_to_replace)
{ … }
static int add_index_entry_with_check(struct index_state *istate, struct cache_entry *ce, int option)
{ … }
int add_index_entry(struct index_state *istate, struct cache_entry *ce, int option)
{ … }
static struct cache_entry *refresh_cache_ent(struct index_state *istate,
struct cache_entry *ce,
unsigned int options, int *err,
int *changed_ret,
int *t2_did_lstat,
int *t2_did_scan)
{ … }
static void show_file(const char * fmt, const char * name, int in_porcelain,
int * first, const char *header_msg)
{ … }
int repo_refresh_and_write_index(struct repository *repo,
unsigned int refresh_flags,
unsigned int write_flags,
int gentle,
const struct pathspec *pathspec,
char *seen, const char *header_msg)
{ … }
int refresh_index(struct index_state *istate, unsigned int flags,
const struct pathspec *pathspec,
char *seen, const char *header_msg)
{ … }
struct cache_entry *refresh_cache_entry(struct index_state *istate,
struct cache_entry *ce,
unsigned int options)
{ … }
#define INDEX_FORMAT_DEFAULT …
static unsigned int get_index_format_default(struct repository *r)
{ … }
struct ondisk_cache_entry { … };
#define align_padding_size(size, len) …
#define align_flex_name(STRUCT,len) …
#define ondisk_cache_entry_size(len) …
#define ondisk_data_size(flags, len) …
#define ondisk_data_size_max(len) …
#define ondisk_ce_size(ce) …
int verify_index_checksum;
int verify_ce_order;
static int verify_hdr(const struct cache_header *hdr, unsigned long size)
{ … }
static int read_index_extension(struct index_state *istate,
const char *ext, const char *data, unsigned long sz)
{ … }
static struct cache_entry *create_from_disk(struct mem_pool *ce_mem_pool,
unsigned int version,
const char *ondisk,
unsigned long *ent_size,
const struct cache_entry *previous_ce)
{ … }
static void check_ce_order(struct index_state *istate)
{ … }
static void tweak_untracked_cache(struct index_state *istate)
{ … }
static void tweak_split_index(struct index_state *istate)
{ … }
static void post_read_index_from(struct index_state *istate)
{ … }
static size_t estimate_cache_size_from_compressed(unsigned int entries)
{ … }
static size_t estimate_cache_size(size_t ondisk_size, unsigned int entries)
{ … }
struct index_entry_offset
{ … };
struct index_entry_offset_table
{ … };
static struct index_entry_offset_table *read_ieot_extension(const char *mmap, size_t mmap_size, size_t offset);
static void write_ieot_extension(struct strbuf *sb, struct index_entry_offset_table *ieot);
static size_t read_eoie_extension(const char *mmap, size_t mmap_size);
static void write_eoie_extension(struct strbuf *sb, git_hash_ctx *eoie_context, size_t offset);
struct load_index_extensions
{ … };
static void *load_index_extensions(void *_data)
{ … }
static unsigned long load_cache_entry_block(struct index_state *istate,
struct mem_pool *ce_mem_pool, int offset, int nr, const char *mmap,
unsigned long start_offset, const struct cache_entry *previous_ce)
{ … }
static unsigned long load_all_cache_entries(struct index_state *istate,
const char *mmap, size_t mmap_size, unsigned long src_offset)
{ … }
#define THREAD_COST …
struct load_cache_entries_thread_data
{ … };
static void *load_cache_entries_thread(void *_data)
{ … }
static unsigned long load_cache_entries_threaded(struct index_state *istate, const char *mmap, size_t mmap_size,
int nr_threads, struct index_entry_offset_table *ieot)
{ … }
static void set_new_index_sparsity(struct index_state *istate)
{ … }
int do_read_index(struct index_state *istate, const char *path, int must_exist)
{ … }
static void freshen_shared_index(const char *shared_index, int warn)
{ … }
int read_index_from(struct index_state *istate, const char *path,
const char *gitdir)
{ … }
int is_index_unborn(struct index_state *istate)
{ … }
void index_state_init(struct index_state *istate, struct repository *r)
{ … }
void release_index(struct index_state *istate)
{ … }
void discard_index(struct index_state *istate)
{ … }
void validate_cache_entries(const struct index_state *istate)
{ … }
int unmerged_index(const struct index_state *istate)
{ … }
int repo_index_has_changes(struct repository *repo,
struct tree *tree,
struct strbuf *sb)
{ … }
static int write_index_ext_header(struct hashfile *f,
git_hash_ctx *eoie_f,
unsigned int ext,
unsigned int sz)
{ … }
static void ce_smudge_racily_clean_entry(struct index_state *istate,
struct cache_entry *ce)
{ … }
static void copy_cache_entry_to_ondisk(struct ondisk_cache_entry *ondisk,
struct cache_entry *ce)
{ … }
static int ce_write_entry(struct hashfile *f, struct cache_entry *ce,
struct strbuf *previous_name, struct ondisk_cache_entry *ondisk)
{ … }
static int verify_index_from(const struct index_state *istate, const char *path)
{ … }
static int repo_verify_index(struct repository *repo)
{ … }
int has_racy_timestamp(struct index_state *istate)
{ … }
void repo_update_index_if_able(struct repository *repo,
struct lock_file *lockfile)
{ … }
static int record_eoie(void)
{ … }
static int record_ieot(void)
{ … }
enum write_extensions { … };
#define WRITE_ALL_EXTENSIONS …
static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
enum write_extensions write_extensions, unsigned flags)
{ … }
void set_alternate_index_output(const char *name)
{ … }
static int commit_locked_index(struct lock_file *lk)
{ … }
static int do_write_locked_index(struct index_state *istate,
struct lock_file *lock,
unsigned flags,
enum write_extensions write_extensions)
{ … }
static int write_split_index(struct index_state *istate,
struct lock_file *lock,
unsigned flags)
{ … }
static unsigned long get_shared_index_expire_date(void)
{ … }
static int should_delete_shared_index(const char *shared_index_path)
{ … }
static int clean_shared_index_files(const char *current_hex)
{ … }
static int write_shared_index(struct index_state *istate,
struct tempfile **temp, unsigned flags)
{ … }
static const int default_max_percent_split_change = …;
static int too_many_not_shared_entries(struct index_state *istate)
{ … }
int write_locked_index(struct index_state *istate, struct lock_file *lock,
unsigned flags)
{ … }
int repo_read_index_unmerged(struct repository *repo)
{ … }
int index_name_is_other(struct index_state *istate, const char *name,
int namelen)
{ … }
void *read_blob_data_from_index(struct index_state *istate,
const char *path, unsigned long *size)
{ … }
void move_index_extensions(struct index_state *dst, struct index_state *src)
{ … }
struct cache_entry *dup_cache_entry(const struct cache_entry *ce,
struct index_state *istate)
{ … }
void discard_cache_entry(struct cache_entry *ce)
{ … }
int should_validate_cache_entries(void)
{ … }
#define EOIE_SIZE …
#define EOIE_SIZE_WITH_HEADER …
static size_t read_eoie_extension(const char *mmap, size_t mmap_size)
{ … }
static void write_eoie_extension(struct strbuf *sb, git_hash_ctx *eoie_context, size_t offset)
{ … }
#define IEOT_VERSION …
static struct index_entry_offset_table *read_ieot_extension(const char *mmap, size_t mmap_size, size_t offset)
{ … }
static void write_ieot_extension(struct strbuf *sb, struct index_entry_offset_table *ieot)
{ … }
void prefetch_cache_entries(const struct index_state *istate,
must_prefetch_predicate must_prefetch)
{ … }
static int read_one_entry_opt(struct index_state *istate,
const struct object_id *oid,
struct strbuf *base,
const char *pathname,
unsigned mode, int opt)
{ … }
static int read_one_entry(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode,
void *context)
{ … }
static int read_one_entry_quick(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode,
void *context)
{ … }
void overlay_tree_on_index(struct index_state *istate,
const char *tree_name, const char *prefix)
{ … }
struct update_callback_data { … };
static int fix_unmerged_status(struct diff_filepair *p,
struct update_callback_data *data)
{ … }
static void update_callback(struct diff_queue_struct *q,
struct diff_options *opt UNUSED, void *cbdata)
{ … }
int add_files_to_cache(struct repository *repo, const char *prefix,
const struct pathspec *pathspec, char *ps_matched,
int include_sparse, int flags)
{ … }