From 27f227fc2762a9796e331d9636033f2d55679947 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 3 Dec 2024 12:21:16 +0100 Subject: Rehash root lookup, if building in compatible mode To avoid unnecessary staging and git imports of computed roots for build in compatible mode, use the rehashing functionality to allow us to compute the git tree of that root in memory. --- src/buildtool/main/main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/buildtool/main/main.cpp') diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index b1e3dbad..34125fcd 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -1041,9 +1041,19 @@ auto main(int argc, char* argv[]) -> int { std::size_t eval_root_jobs = std::lround(std::ceil(std::sqrt(arguments.common.jobs))); #ifndef BOOTSTRAP_BUILD_TOOL + const bool need_rehash = + arguments.protocol.hash_type != HashFunction::Type::GitSHA1; + const auto git_storage_config = + need_rehash ? CreateStorageConfig(arguments.endpoint, + HashFunction::Type::GitSHA1) + : std::nullopt; + if (need_rehash and (not git_storage_config)) { + return kExitFailure; + } if (not EvaluateComputedRoots(&repo_config, main_repo, *storage_config, + git_storage_config, traverse_args, &exec_context, eval_root_jobs)) { -- cgit v1.2.3