diff options
Diffstat (limited to 'repository.h')
| -rw-r--r-- | repository.h | 91 |
1 files changed, 35 insertions, 56 deletions
diff --git a/repository.h b/repository.h index 21949c5a17..24a66a496a 100644 --- a/repository.h +++ b/repository.h @@ -1,8 +1,10 @@ #ifndef REPOSITORY_H #define REPOSITORY_H +#include "strmap.h" +#include "repo-settings.h" + struct config_set; -struct fsmonitor_settings; struct git_hash_algo; struct index_state; struct lock_file; @@ -12,54 +14,10 @@ struct submodule_cache; struct promisor_remote_config; struct remote_state; -enum untracked_cache_setting { - UNTRACKED_CACHE_KEEP, - UNTRACKED_CACHE_REMOVE, - UNTRACKED_CACHE_WRITE, -}; - -enum fetch_negotiation_setting { - FETCH_NEGOTIATION_CONSECUTIVE, - FETCH_NEGOTIATION_SKIPPING, - FETCH_NEGOTIATION_NOOP, -}; - -#define REF_STORAGE_FORMAT_UNKNOWN 0 -#define REF_STORAGE_FORMAT_FILES 1 - -struct repo_settings { - int initialized; - - int core_commit_graph; - int commit_graph_generation_version; - int commit_graph_read_changed_paths; - int gc_write_commit_graph; - int fetch_write_commit_graph; - int command_requires_full_index; - int sparse_index; - int pack_read_reverse_index; - int pack_use_bitmap_boundary_traversal; - int pack_use_multi_pack_reuse; - - /* - * Does this repository have core.useReplaceRefs=true (on by - * default)? This provides a repository-scoped version of this - * config, though it could be disabled process-wide via some Git - * builtins or the --no-replace-objects option. See - * replace_refs_enabled() for more details. - */ - int read_replace_refs; - - struct fsmonitor_settings *fsmonitor; /* lazily loaded */ - - int index_version; - int index_skip_hash; - enum untracked_cache_setting core_untracked_cache; - - int pack_use_sparse; - enum fetch_negotiation_setting fetch_negotiation_algorithm; - - int core_multi_pack_index; +enum ref_storage_format { + REF_STORAGE_FORMAT_UNKNOWN, + REF_STORAGE_FORMAT_FILES, + REF_STORAGE_FORMAT_REFTABLE, }; struct repo_path_cache { @@ -108,6 +66,18 @@ struct repository { struct ref_store *refs_private; /* + * A strmap of ref_stores, stored by submodule name, accessible via + * `repo_get_submodule_ref_store()`. + */ + struct strmap submodule_ref_stores; + + /* + * A strmap of ref_stores, stored by worktree id, accessible via + * `get_worktree_ref_store()`. + */ + struct strmap worktree_ref_stores; + + /* * Contains path to often used file names. */ struct repo_path_cache cached_paths; @@ -162,8 +132,11 @@ struct repository { /* Repository's current hash algorithm, as serialized on disk. */ const struct git_hash_algo *hash_algo; + /* Repository's compatibility hash algorithm. */ + const struct git_hash_algo *compat_hash_algo; + /* Repository's reference storage format, as serialized on disk. */ - unsigned int ref_storage_format; + enum ref_storage_format ref_storage_format; /* A unique-id for tracing purposes. */ int trace2_repo_id; @@ -182,11 +155,17 @@ struct repository { unsigned different_commondir:1; }; +#ifdef USE_THE_REPOSITORY_VARIABLE extern struct repository *the_repository; -#ifdef USE_THE_INDEX_VARIABLE -extern struct index_state the_index; #endif +const char *repo_get_git_dir(struct repository *repo); +const char *repo_get_common_dir(struct repository *repo); +const char *repo_get_object_directory(struct repository *repo); +const char *repo_get_index_file(struct repository *repo); +const char *repo_get_graft_file(struct repository *repo); +const char *repo_get_work_tree(struct repository *repo); + /* * Define a custom repository layout. Any field can be NULL, which * will default back to the path according to the default layout. @@ -204,8 +183,10 @@ void repo_set_gitdir(struct repository *repo, const char *root, const struct set_gitdir_args *extra_args); void repo_set_worktree(struct repository *repo, const char *path); void repo_set_hash_algo(struct repository *repo, int algo); -void repo_set_ref_storage_format(struct repository *repo, unsigned int format); -void initialize_the_repository(void); +void repo_set_compat_hash_algo(struct repository *repo, int compat_algo); +void repo_set_ref_storage_format(struct repository *repo, + enum ref_storage_format format); +void initialize_repository(struct repository *repo); RESULT_MUST_BE_USED int repo_init(struct repository *r, const char *gitdir, const char *worktree); @@ -245,8 +226,6 @@ int repo_read_index_unmerged(struct repository *); */ void repo_update_index_if_able(struct repository *, struct lock_file *); -void prepare_repo_settings(struct repository *r); - /* * Return 1 if upgrade repository format to target_version succeeded, * 0 if no upgrade is necessary, and -1 when upgrade is not possible. |
