diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2023-10-02 04:40:09 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-10-02 23:57:38 +0200 |
commit | 23b2c7e95b6f8f3045665835d2dc5028701eff18 (patch) | |
tree | ffc99ac1e4307004da2e31947e6806de3259319a /repository.c | |
parent | repository: add a compatibility hash algorithm (diff) | |
download | git-23b2c7e95b6f8f3045665835d2dc5028701eff18.tar.xz git-23b2c7e95b6f8f3045665835d2dc5028701eff18.zip |
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.c | 6 |
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; |