Merge branch 'sb/object-store'
Refactoring the internal global data structure to make it possible to open multiple repositories, work with and then close them. Rerolled by Duy on top of a separate preliminary clean-up topic. The resulting structure of the topics looked very sensible. * sb/object-store: (27 commits) sha1_file: allow sha1_loose_object_info to handle arbitrary repositories sha1_file: allow map_sha1_file to handle arbitrary repositories sha1_file: allow map_sha1_file_1 to handle arbitrary repositories sha1_file: allow open_sha1_file to handle arbitrary repositories sha1_file: allow stat_sha1_file to handle arbitrary repositories sha1_file: allow sha1_file_name to handle arbitrary repositories sha1_file: add repository argument to sha1_loose_object_info sha1_file: add repository argument to map_sha1_file sha1_file: add repository argument to map_sha1_file_1 sha1_file: add repository argument to open_sha1_file sha1_file: add repository argument to stat_sha1_file sha1_file: add repository argument to sha1_file_name sha1_file: allow prepare_alt_odb to handle arbitrary repositories sha1_file: allow link_alt_odb_entries to handle arbitrary repositories sha1_file: add repository argument to prepare_alt_odb sha1_file: add repository argument to link_alt_odb_entries sha1_file: add repository argument to read_info_alternates sha1_file: add repository argument to link_alt_odb_entry sha1_file: add raw_object_store argument to alt_odb_usable pack: move approximate object count to object store ...
This commit is contained in:
87
cache.h
87
cache.h
@ -940,12 +940,6 @@ extern void check_repository_format(void);
|
||||
#define DATA_CHANGED 0x0020
|
||||
#define TYPE_CHANGED 0x0040
|
||||
|
||||
/*
|
||||
* Put in `buf` the name of the file in the local object database that
|
||||
* would be used to store a loose object with the specified sha1.
|
||||
*/
|
||||
extern void sha1_file_name(struct strbuf *buf, const unsigned char *sha1);
|
||||
|
||||
/*
|
||||
* Return an abbreviated sha1 unique within this repository's object database.
|
||||
* The result will be at least `len` characters long, and will be NUL
|
||||
@ -1236,7 +1230,6 @@ extern int force_object_loose(const struct object_id *oid, time_t mtime);
|
||||
|
||||
extern int git_open_cloexec(const char *name, int flags);
|
||||
#define git_open(name) git_open_cloexec(name, O_RDONLY)
|
||||
extern void *map_sha1_file(const unsigned char *sha1, unsigned long *size);
|
||||
extern int unpack_sha1_header(git_zstream *stream, unsigned char *map, unsigned long mapsize, void *buffer, unsigned long bufsiz);
|
||||
extern int parse_sha1_header(const char *hdr, unsigned long *sizep);
|
||||
|
||||
@ -1564,57 +1557,6 @@ extern int has_dirs_only_path(const char *name, int len, int prefix_len);
|
||||
extern void schedule_dir_for_removal(const char *name, int len);
|
||||
extern void remove_scheduled_dirs(void);
|
||||
|
||||
extern struct alternate_object_database {
|
||||
struct alternate_object_database *next;
|
||||
|
||||
/* see alt_scratch_buf() */
|
||||
struct strbuf scratch;
|
||||
size_t base_len;
|
||||
|
||||
/*
|
||||
* Used to store the results of readdir(3) calls when searching
|
||||
* for unique abbreviated hashes. This cache is never
|
||||
* invalidated, thus it's racy and not necessarily accurate.
|
||||
* That's fine for its purpose; don't use it for tasks requiring
|
||||
* greater accuracy!
|
||||
*/
|
||||
char loose_objects_subdir_seen[256];
|
||||
struct oid_array loose_objects_cache;
|
||||
|
||||
char path[FLEX_ARRAY];
|
||||
} *alt_odb_list;
|
||||
extern void prepare_alt_odb(void);
|
||||
extern char *compute_alternate_path(const char *path, struct strbuf *err);
|
||||
typedef int alt_odb_fn(struct alternate_object_database *, void *);
|
||||
extern int foreach_alt_odb(alt_odb_fn, void*);
|
||||
|
||||
/*
|
||||
* Allocate a "struct alternate_object_database" but do _not_ actually
|
||||
* add it to the list of alternates.
|
||||
*/
|
||||
struct alternate_object_database *alloc_alt_odb(const char *dir);
|
||||
|
||||
/*
|
||||
* Add the directory to the on-disk alternates file; the new entry will also
|
||||
* take effect in the current process.
|
||||
*/
|
||||
extern void add_to_alternates_file(const char *dir);
|
||||
|
||||
/*
|
||||
* Add the directory to the in-memory list of alternates (along with any
|
||||
* recursive alternates it points to), but do not modify the on-disk alternates
|
||||
* file.
|
||||
*/
|
||||
extern void add_to_alternates_memory(const char *dir);
|
||||
|
||||
/*
|
||||
* Returns a scratch strbuf pre-filled with the alternate object directory,
|
||||
* including a trailing slash, which can be used to access paths in the
|
||||
* alternate. Always use this over direct access to alt->scratch, as it
|
||||
* cleans up any previous use of the scratch buffer.
|
||||
*/
|
||||
extern struct strbuf *alt_scratch_buf(struct alternate_object_database *alt);
|
||||
|
||||
struct pack_window {
|
||||
struct pack_window *next;
|
||||
unsigned char *base;
|
||||
@ -1624,35 +1566,6 @@ struct pack_window {
|
||||
unsigned int inuse_cnt;
|
||||
};
|
||||
|
||||
extern struct packed_git {
|
||||
struct packed_git *next;
|
||||
struct list_head mru;
|
||||
struct pack_window *windows;
|
||||
off_t pack_size;
|
||||
const void *index_data;
|
||||
size_t index_size;
|
||||
uint32_t num_objects;
|
||||
uint32_t num_bad_objects;
|
||||
unsigned char *bad_object_sha1;
|
||||
int index_version;
|
||||
time_t mtime;
|
||||
int pack_fd;
|
||||
unsigned pack_local:1,
|
||||
pack_keep:1,
|
||||
freshened:1,
|
||||
do_not_close:1,
|
||||
pack_promisor:1;
|
||||
unsigned char sha1[20];
|
||||
struct revindex_entry *revindex;
|
||||
/* something like ".git/objects/pack/xxxxx.pack" */
|
||||
char pack_name[FLEX_ARRAY]; /* more */
|
||||
} *packed_git;
|
||||
|
||||
/*
|
||||
* A most-recently-used ordered version of the packed_git list.
|
||||
*/
|
||||
extern struct list_head packed_git_mru;
|
||||
|
||||
struct pack_entry {
|
||||
off_t offset;
|
||||
unsigned char sha1[20];
|
||||
|
||||
Reference in New Issue
Block a user