Documentation/Makefile add optional targets for l10n
[gitweb.git] / repository.c
index 02fe884603df56ea0996121152b7640afb56a48f..7b02e1dffac077d0c21ecaef915f4ea33abc57bc 100644 (file)
@@ -2,6 +2,7 @@
 #include "repository.h"
 #include "object-store.h"
 #include "config.h"
+#include "object.h"
 #include "submodule-config.h"
 
 /* The main repository */
@@ -14,6 +15,8 @@ void initialize_the_repository(void)
 
        the_repo.index = &the_index;
        the_repo.objects = raw_object_store_new();
+       the_repo.parsed_objects = parsed_object_pool_new();
+
        repo_set_hash_algo(&the_repo, GIT_HASH_SHA1);
 }
 
@@ -60,8 +63,14 @@ void repo_set_gitdir(struct repository *repo,
        free(old_gitdir);
 
        repo_set_commondir(repo, o->commondir);
-       expand_base_dir(&repo->objects->objectdir, o->object_dir,
+
+       if (!repo->objects->odb) {
+               repo->objects->odb = xcalloc(1, sizeof(*repo->objects->odb));
+               repo->objects->odb_tail = &repo->objects->odb->next;
+       }
+       expand_base_dir(&repo->objects->odb->path, o->object_dir,
                        repo->commondir, "objects");
+
        free(repo->objects->alternate_db);
        repo->objects->alternate_db = xstrdup_or_null(o->alternate_db);
        expand_base_dir(&repo->graft_file, o->graft_file,
@@ -143,6 +152,7 @@ int repo_init(struct repository *repo,
        memset(repo, 0, sizeof(*repo));
 
        repo->objects = raw_object_store_new();
+       repo->parsed_objects = parsed_object_pool_new();
 
        if (repo_init_gitdir(repo, gitdir))
                goto error;
@@ -226,6 +236,9 @@ void repo_clear(struct repository *repo)
        raw_object_store_clear(repo->objects);
        FREE_AND_NULL(repo->objects);
 
+       parsed_object_pool_clear(repo->parsed_objects);
+       FREE_AND_NULL(repo->parsed_objects);
+
        if (repo->config) {
                git_configset_clear(repo->config);
                FREE_AND_NULL(repo->config);