From 74498f0633d9039bbb7971efa33d4242cd724812 Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Thu, 12 Sep 2024 10:41:23 +0200 Subject: Check compatibility in add_to_cas based on the hash type --- src/buildtool/main/add_to_cas.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/buildtool/main/add_to_cas.cpp') diff --git a/src/buildtool/main/add_to_cas.cpp b/src/buildtool/main/add_to_cas.cpp index 640c4621..819fa532 100644 --- a/src/buildtool/main/add_to_cas.cpp +++ b/src/buildtool/main/add_to_cas.cpp @@ -23,6 +23,7 @@ #include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/common/protocol_traits.hpp" +#include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp" #include "src/buildtool/execution_api/common/execution_api.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" @@ -71,7 +72,8 @@ auto AddArtifactsToCas(ToAddArguments const& clargs, digest = cas.StoreBlob(*content, /*is_executable=*/false); } break; case ObjectType::Tree: { - if (ProtocolTraits::Instance().IsCompatible()) { + if (not ProtocolTraits::IsTreeAllowed( + cas.GetHashFunction().GetType())) { Logger::Log(LogLevel::Error, "Storing of trees only supported in native mode"); return false; @@ -115,4 +117,4 @@ auto AddArtifactsToCas(ToAddArguments const& clargs, return true; } -#endif +#endif // BOOTSTRAP_BUILD_TOOL -- cgit v1.2.3