aboutsummaryrefslogtreecommitdiffstats
path: root/repository.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2023-10-01 21:40:09 -0500
committerJunio C Hamano <gitster@pobox.com>2023-10-02 14:57:38 -0700
commit23b2c7e95b6f8f3045665835d2dc5028701eff18 (patch)
treeffc99ac1e4307004da2e31947e6806de3259319a /repository.c
parent15a1ca1abe8dafa9bf3bf924b4e3c6b851717ee2 (diff)
downloadgit-23b2c7e95b6f8f3045665835d2dc5028701eff18.tar.gz
loose: add a mapping between SHA-1 and SHA-256 for loose objects
As part of the transition plan, we'd like to add a file in the .git directory that maps loose objects between SHA-1 and SHA-256. Let's implement the specification in the transition plan and store this data on a per-repository basis in struct repository. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'repository.c')
-rw-r--r--repository.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/repository.c b/repository.c
index 80252b79e9..6214f61cf4 100644
--- a/repository.c
+++ b/repository.c
@@ -14,6 +14,7 @@
#include "read-cache-ll.h"
#include "remote.h"
#include "setup.h"
+#include "loose.h"
#include "submodule-config.h"
#include "sparse-index.h"
#include "trace2.h"
@@ -109,6 +110,8 @@ void repo_set_compat_hash_algo(struct repository *repo, int algo)
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);
}
/*
@@ -201,6 +204,9 @@ int repo_init(struct repository *repo,
if (worktree)
repo_set_worktree(repo, worktree);
+ if (repo->compat_hash_algo)
+ repo_read_loose_object_map(repo);
+
clear_repository_format(&format);
return 0;