aboutsummaryrefslogtreecommitdiffstats
path: root/repository.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--repository.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/repository.c b/repository.c
index 6faf5c7398..a9d9d4dc95 100644
--- a/repository.c
+++ b/repository.c
@@ -3,6 +3,7 @@
#include "repository.h"
#include "odb.h"
#include "config.h"
+#include "gettext.h"
#include "object.h"
#include "lockfile.h"
#include "path.h"
@@ -38,7 +39,7 @@ struct repository *the_repository = &the_repo;
static void set_default_hash_algo(struct repository *repo)
{
const char *hash_name;
- int algo;
+ uint32_t algo;
hash_name = getenv("GIT_TEST_DEFAULT_HASH_ALGO");
if (!hash_name)
@@ -160,20 +161,24 @@ void repo_set_gitdir(struct repository *repo,
* until after xstrdup(root). Then we can free it.
*/
char *old_gitdir = repo->gitdir;
+ char *objects_path = NULL;
repo->gitdir = xstrdup(gitfile ? gitfile : root);
free(old_gitdir);
repo_set_commondir(repo, o->commondir);
+ expand_base_dir(&objects_path, o->object_dir,
+ repo->commondir, "objects");
if (!repo->objects->sources) {
- CALLOC_ARRAY(repo->objects->sources, 1);
- repo->objects->sources->odb = repo->objects;
- repo->objects->sources->local = true;
+ repo->objects->sources = odb_source_new(repo->objects,
+ objects_path, true);
repo->objects->sources_tail = &repo->objects->sources->next;
+ free(objects_path);
+ } else {
+ free(repo->objects->sources->path);
+ repo->objects->sources->path = objects_path;
}
- expand_base_dir(&repo->objects->sources->path, o->object_dir,
- repo->commondir, "objects");
repo->objects->sources->disable_ref_updates = o->disable_ref_updates;
@@ -185,18 +190,24 @@ void repo_set_gitdir(struct repository *repo,
repo->gitdir, "index");
}
-void repo_set_hash_algo(struct repository *repo, int hash_algo)
+void repo_set_hash_algo(struct repository *repo, uint32_t hash_algo)
{
repo->hash_algo = &hash_algos[hash_algo];
}
-void repo_set_compat_hash_algo(struct repository *repo, int algo)
+void repo_set_compat_hash_algo(struct repository *repo, uint32_t algo)
{
+#ifdef WITH_RUST
if (hash_algo_by_ptr(repo->hash_algo) == algo)
BUG("hash_algo and compat_hash_algo match");
repo->compat_hash_algo = algo ? &hash_algos[algo] : NULL;
if (repo->compat_hash_algo)
repo_read_loose_object_map(repo);
+#else
+ (void)repo;
+ if (algo)
+ die(_("compatibility hash algorithm support requires Rust"));
+#endif
}
void repo_set_ref_storage_format(struct repository *repo,
@@ -288,6 +299,7 @@ int repo_init(struct repository *repo,
repo->repository_format_worktree_config = format.worktree_config;
repo->repository_format_relative_worktrees = format.relative_worktrees;
repo->repository_format_precious_objects = format.precious_objects;
+ repo->repository_format_submodule_encoding = format.submodule_encoding;
/* take ownership of format.partial_clone */
repo->repository_format_partial_clone = format.partial_clone;