Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'repository.c')
-rw-r--r--repository.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/repository.c b/repository.c
index 5d166b692c..d7d24d416a 100644
--- a/repository.c
+++ b/repository.c
@@ -2,16 +2,21 @@
* not really _using_ the compat macros, just make sure the_index
* declaration matches the definition in this file.
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
-#include "cache.h"
+#define USE_THE_INDEX_VARIABLE
+#include "git-compat-util.h"
+#include "abspath.h"
#include "repository.h"
-#include "object-store.h"
+#include "object-store-ll.h"
#include "config.h"
#include "object.h"
#include "lockfile.h"
+#include "path.h"
+#include "read-cache-ll.h"
#include "remote.h"
+#include "setup.h"
#include "submodule-config.h"
#include "sparse-index.h"
+#include "trace2.h"
#include "promisor-remote.h"
/* The main repository */
@@ -28,6 +33,8 @@ void initialize_the_repository(void)
the_repo.remote_state = remote_state_new();
the_repo.parsed_objects = parsed_object_pool_new();
+ index_state_init(&the_index, the_repository);
+
repo_set_hash_algo(&the_repo, GIT_HASH_SHA1);
}
@@ -97,6 +104,11 @@ void repo_set_hash_algo(struct repository *repo, int hash_algo)
repo->hash_algo = &hash_algos[hash_algo];
}
+void repo_set_ref_storage_format(struct repository *repo, unsigned int format)
+{
+ repo->ref_storage_format = format;
+}
+
/*
* Attempt to resolve and set the provided 'gitdir' for repository 'repo'.
* Return 0 upon success and a non-zero value upon failure.
@@ -177,6 +189,8 @@ int repo_init(struct repository *repo,
goto error;
repo_set_hash_algo(repo, format.hash_algo);
+ repo_set_ref_storage_format(repo, format.ref_storage_format);
+ repo->repository_format_worktree_config = format.worktree_config;
/* take ownership of format.partial_clone */
repo->repository_format_partial_clone = format.partial_clone;
@@ -302,14 +316,13 @@ int repo_read_index(struct repository *repo)
{
int res;
- if (!repo->index)
- CALLOC_ARRAY(repo->index, 1);
-
/* Complete the double-reference */
- if (!repo->index->repo)
- repo->index->repo = repo;
- else if (repo->index->repo != repo)
+ if (!repo->index) {
+ ALLOC_ARRAY(repo->index, 1);
+ index_state_init(repo->index, repo);
+ } else if (repo->index->repo != repo) {
BUG("repo's index should point back at itself");
+ }
res = read_index_from(repo->index, repo->index_file, repo->gitdir);