From: Patrick Steinhardt Date: Thu, 4 Jun 2026 07:46:31 +0000 (+0200) Subject: repository: stop reading loose object map twice on repo init X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a84a9d4acdae51f58529b2596c4bd935fe9af372;p=thirdparty%2Fgit.git repository: stop reading loose object map twice on repo init When initializing a repository via `repo_init()` we end up reading the loose object map twice: - `apply_repository_format()` calls `repo_set_compat_hash_algo()`, which in turn calls `repo_read_loose_object_map()` if we have a compatibility hash configured. - `repo_init()` calls `repo_read_loose_object_map()` directly a second time. Drop the second read of the loose object map in `repo_init()`. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- diff --git a/repository.c b/repository.c index 2c2395105f..61dfbb8be6 100644 --- a/repository.c +++ b/repository.c @@ -301,9 +301,6 @@ 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); strbuf_release(&err); return 0;