#define USE_THE_REPOSITORY_VARIABLE
#include "git-compat-util.h"
#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "list.h"
#include "pack.h"
#include "repository.h"
#include "dir.h"
#include "mergesort.h"
#include "packfile.h"
#include "delta.h"
#include "hash-lookup.h"
#include "commit.h"
#include "object.h"
#include "tag.h"
#include "trace.h"
#include "tree-walk.h"
#include "tree.h"
#include "object-file.h"
#include "object-store-ll.h"
#include "midx.h"
#include "commit-graph.h"
#include "pack-revindex.h"
#include "promisor-remote.h"
char *odb_pack_name(struct strbuf *buf,
const unsigned char *hash,
const char *ext)
{ … }
char *sha1_pack_name(const unsigned char *sha1)
{ … }
char *sha1_pack_index_name(const unsigned char *sha1)
{ … }
static unsigned int pack_used_ctr;
static unsigned int pack_mmap_calls;
static unsigned int peak_pack_open_windows;
static unsigned int pack_open_windows;
static unsigned int pack_open_fds;
static unsigned int pack_max_fds;
static size_t peak_pack_mapped;
static size_t pack_mapped;
#define SZ_FMT …
static inline uintmax_t sz_fmt(size_t s) { … }
void pack_report(void)
{ … }
static int check_packed_git_idx(const char *path, struct packed_git *p)
{ … }
int load_idx(const char *path, const unsigned int hashsz, void *idx_map,
size_t idx_size, struct packed_git *p)
{ … }
int open_pack_index(struct packed_git *p)
{ … }
uint32_t get_pack_fanout(struct packed_git *p, uint32_t value)
{ … }
static struct packed_git *alloc_packed_git(int extra)
{ … }
struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_path)
{ … }
static void scan_windows(struct packed_git *p,
struct packed_git **lru_p,
struct pack_window **lru_w,
struct pack_window **lru_l)
{ … }
static int unuse_one_window(struct packed_git *current)
{ … }
void close_pack_windows(struct packed_git *p)
{ … }
int close_pack_fd(struct packed_git *p)
{ … }
void close_pack_index(struct packed_git *p)
{ … }
static void close_pack_revindex(struct packed_git *p)
{ … }
static void close_pack_mtimes(struct packed_git *p)
{ … }
void close_pack(struct packed_git *p)
{ … }
void close_object_store(struct raw_object_store *o)
{ … }
void unlink_pack_path(const char *pack_name, int force_delete)
{ … }
static void find_lru_pack(struct packed_git *p, struct packed_git **lru_p, struct pack_window **mru_w, int *accept_windows_inuse)
{ … }
static int close_one_pack(void)
{ … }
static unsigned int get_max_fd_limit(void)
{ … }
const char *pack_basename(struct packed_git *p)
{ … }
static int open_packed_git_1(struct packed_git *p)
{ … }
static int open_packed_git(struct packed_git *p)
{ … }
static int in_window(struct pack_window *win, off_t offset)
{ … }
unsigned char *use_pack(struct packed_git *p,
struct pack_window **w_cursor,
off_t offset,
unsigned long *left)
{ … }
void unuse_pack(struct pack_window **w_cursor)
{ … }
struct packed_git *add_packed_git(const char *path, size_t path_len, int local)
{ … }
void install_packed_git(struct repository *r, struct packed_git *pack)
{ … }
void (*report_garbage)(unsigned seen_bits, const char *path);
static void report_helper(const struct string_list *list,
int seen_bits, int first, int last)
{ … }
static void report_pack_garbage(struct string_list *list)
{ … }
void for_each_file_in_pack_subdir(const char *objdir,
const char *subdir,
each_file_in_pack_dir_fn fn,
void *data)
{ … }
void for_each_file_in_pack_dir(const char *objdir,
each_file_in_pack_dir_fn fn,
void *data)
{ … }
struct prepare_pack_data { … };
static void prepare_pack(const char *full_name, size_t full_name_len,
const char *file_name, void *_data)
{ … }
static void prepare_packed_git_one(struct repository *r, char *objdir, int local)
{ … }
static void prepare_packed_git(struct repository *r);
unsigned long repo_approximate_object_count(struct repository *r)
{ … }
DEFINE_LIST_SORT(…) …;
static int sort_pack(const struct packed_git *a, const struct packed_git *b)
{ … }
static void rearrange_packed_git(struct repository *r)
{ … }
static void prepare_packed_git_mru(struct repository *r)
{ … }
static void prepare_packed_git(struct repository *r)
{ … }
void reprepare_packed_git(struct repository *r)
{ … }
struct packed_git *get_packed_git(struct repository *r)
{ … }
struct multi_pack_index *get_multi_pack_index(struct repository *r)
{ … }
struct multi_pack_index *get_local_multi_pack_index(struct repository *r)
{ … }
struct packed_git *get_all_packs(struct repository *r)
{ … }
struct list_head *get_packed_git_mru(struct repository *r)
{ … }
unsigned long unpack_object_header_buffer(const unsigned char *buf,
unsigned long len, enum object_type *type, unsigned long *sizep)
{ … }
unsigned long get_size_from_delta(struct packed_git *p,
struct pack_window **w_curs,
off_t curpos)
{ … }
int unpack_object_header(struct packed_git *p,
struct pack_window **w_curs,
off_t *curpos,
unsigned long *sizep)
{ … }
void mark_bad_packed_object(struct packed_git *p, const struct object_id *oid)
{ … }
const struct packed_git *has_packed_and_bad(struct repository *r,
const struct object_id *oid)
{ … }
off_t get_delta_base(struct packed_git *p,
struct pack_window **w_curs,
off_t *curpos,
enum object_type type,
off_t delta_obj_offset)
{ … }
static int get_delta_base_oid(struct packed_git *p,
struct pack_window **w_curs,
off_t curpos,
struct object_id *oid,
enum object_type type,
off_t delta_obj_offset)
{ … }
static int retry_bad_packed_offset(struct repository *r,
struct packed_git *p,
off_t obj_offset)
{ … }
#define POI_STACK_PREALLOC …
static enum object_type packed_to_object_type(struct repository *r,
struct packed_git *p,
off_t obj_offset,
enum object_type type,
struct pack_window **w_curs,
off_t curpos)
{ … }
static struct hashmap delta_base_cache;
static size_t delta_base_cached;
static LIST_HEAD(delta_base_cache_lru);
struct delta_base_cache_key { … };
struct delta_base_cache_entry { … };
static unsigned int pack_entry_hash(struct packed_git *p, off_t base_offset)
{ … }
static struct delta_base_cache_entry *
get_delta_base_cache_entry(struct packed_git *p, off_t base_offset)
{ … }
static int delta_base_cache_key_eq(const struct delta_base_cache_key *a,
const struct delta_base_cache_key *b)
{ … }
static int delta_base_cache_hash_cmp(const void *cmp_data UNUSED,
const struct hashmap_entry *va,
const struct hashmap_entry *vb,
const void *vkey)
{ … }
static int in_delta_base_cache(struct packed_git *p, off_t base_offset)
{ … }
static void detach_delta_base_cache_entry(struct delta_base_cache_entry *ent)
{ … }
static void *cache_or_unpack_entry(struct repository *r, struct packed_git *p,
off_t base_offset, unsigned long *base_size,
enum object_type *type)
{ … }
static inline void release_delta_base_cache(struct delta_base_cache_entry *ent)
{ … }
void clear_delta_base_cache(void)
{ … }
static void add_delta_base_cache(struct packed_git *p, off_t base_offset,
void *base, unsigned long base_size, enum object_type type)
{ … }
int packed_object_info(struct repository *r, struct packed_git *p,
off_t obj_offset, struct object_info *oi)
{ … }
static void *unpack_compressed_entry(struct packed_git *p,
struct pack_window **w_curs,
off_t curpos,
unsigned long size)
{ … }
static void write_pack_access_log(struct packed_git *p, off_t obj_offset)
{ … }
int do_check_packed_object_crc;
#define UNPACK_ENTRY_STACK_PREALLOC …
struct unpack_entry_stack_ent { … };
void *unpack_entry(struct repository *r, struct packed_git *p, off_t obj_offset,
enum object_type *final_type, unsigned long *final_size)
{ … }
int bsearch_pack(const struct object_id *oid, const struct packed_git *p, uint32_t *result)
{ … }
int nth_packed_object_id(struct object_id *oid,
struct packed_git *p,
uint32_t n)
{ … }
void check_pack_index_ptr(const struct packed_git *p, const void *vptr)
{ … }
off_t nth_packed_object_offset(const struct packed_git *p, uint32_t n)
{ … }
off_t find_pack_entry_one(const unsigned char *sha1,
struct packed_git *p)
{ … }
int is_pack_valid(struct packed_git *p)
{ … }
struct packed_git *find_sha1_pack(const unsigned char *sha1,
struct packed_git *packs)
{ … }
static int fill_pack_entry(const struct object_id *oid,
struct pack_entry *e,
struct packed_git *p)
{ … }
int find_pack_entry(struct repository *r, const struct object_id *oid, struct pack_entry *e)
{ … }
static void maybe_invalidate_kept_pack_cache(struct repository *r,
unsigned flags)
{ … }
static struct packed_git **kept_pack_cache(struct repository *r, unsigned flags)
{ … }
int find_kept_pack_entry(struct repository *r,
const struct object_id *oid,
unsigned flags,
struct pack_entry *e)
{ … }
int has_object_pack(const struct object_id *oid)
{ … }
int has_object_kept_pack(const struct object_id *oid, unsigned flags)
{ … }
int has_pack_index(const unsigned char *sha1)
{ … }
int for_each_object_in_pack(struct packed_git *p,
each_packed_object_fn cb, void *data,
enum for_each_object_flags flags)
{ … }
int for_each_packed_object(each_packed_object_fn cb, void *data,
enum for_each_object_flags flags)
{ … }
static int add_promisor_object(const struct object_id *oid,
struct packed_git *pack UNUSED,
uint32_t pos UNUSED,
void *set_)
{ … }
int is_promisor_object(const struct object_id *oid)
{ … }