diff options
Diffstat (limited to 'object-store.h')
| -rw-r--r-- | object-store.h | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/object-store.h b/object-store.h index a3be27d117..d199d757d7 100644 --- a/object-store.h +++ b/object-store.h @@ -13,8 +13,20 @@ struct oidtree; struct strbuf; struct repository; -struct object_directory { - struct object_directory *next; +/* + * The source is the part of the object database that stores the actual + * objects. It thus encapsulates the logic to read and write the specific + * on-disk format. An object database can have multiple sources: + * + * - The primary source, which is typically located in "$GIT_DIR/objects". + * This is where new objects are usually written to. + * + * - Alternate sources, which are configured via "objects/info/alternates" or + * via the GIT_ALTERNATE_OBJECT_DIRECTORIES environment variable. These + * alternate sources are only used to read objects. + */ +struct odb_source { + struct odb_source *next; /* * Used to store the results of readdir(3) calls when we are OK @@ -44,8 +56,8 @@ struct object_directory { int will_destroy; /* - * Path to the alternative object store. If this is a relative path, - * it is relative to the current working directory. + * Path to the source. If this is a relative path, it is relative to + * the current working directory. */ char *path; }; @@ -53,8 +65,8 @@ struct object_directory { void prepare_alt_odb(struct repository *r); int has_alt_odb(struct repository *r); char *compute_alternate_path(const char *path, struct strbuf *err); -struct object_directory *find_odb(struct repository *r, const char *obj_dir); -typedef int alt_odb_fn(struct object_directory *, void *); +struct odb_source *find_odb(struct repository *r, const char *obj_dir); +typedef int alt_odb_fn(struct odb_source *, void *); int foreach_alt_odb(alt_odb_fn, void*); typedef void alternate_ref_fn(const struct object_id *oid, void *); void for_each_alternate_ref(alternate_ref_fn, void *); @@ -76,12 +88,12 @@ void add_to_alternates_memory(const char *dir); * Replace the current writable object directory with the specified temporary * object directory; returns the former primary object directory. */ -struct object_directory *set_temporary_primary_odb(const char *dir, int will_destroy); +struct odb_source *set_temporary_primary_odb(const char *dir, int will_destroy); /* * Restore a previous ODB replaced by set_temporary_main_odb. */ -void restore_primary_odb(struct object_directory *restore_odb, const char *old_path); +void restore_primary_odb(struct odb_source *restore_alternate, const char *old_path); struct packed_git; struct multi_pack_index; @@ -89,7 +101,7 @@ struct cached_object_entry; /* * The object database encapsulates access to objects in a repository. It - * manages one or more backends that store the actual objects which are + * manages one or more sources that store the actual objects which are * configured via alternates. */ struct object_database { @@ -98,16 +110,16 @@ struct object_database { * cannot be NULL after initialization). Subsequent directories are * alternates. */ - struct object_directory *odb; - struct object_directory **odb_tail; - struct kh_odb_path_map *odb_by_path; + struct odb_source *sources; + struct odb_source **sources_tail; + struct kh_odb_path_map *source_by_path; int loaded_alternates; /* * A list of alternate object directories loaded from the environment; * this should not generally need to be accessed directly, but will - * populate the "odb" list when prepare_alt_odb() is run. + * populate the "sources" list when prepare_alt_odb() is run. */ char *alternate_db; |
