From ddf48a60029bed958fb2cf0238dbb0bca0b770fb Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Wed, 11 Sep 2024 10:21:13 +0200 Subject: Add to ProtocolTraits static functions that provide protocol-specific behaviour --- src/buildtool/common/artifact_digest_factory.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/buildtool/common/artifact_digest_factory.cpp') diff --git a/src/buildtool/common/artifact_digest_factory.cpp b/src/buildtool/common/artifact_digest_factory.cpp index dd9da28d..f3ea30c1 100644 --- a/src/buildtool/common/artifact_digest_factory.cpp +++ b/src/buildtool/common/artifact_digest_factory.cpp @@ -17,15 +17,17 @@ #include "gsl/gsl" #include "src/buildtool/common/bazel_digest_factory.hpp" #include "src/buildtool/common/bazel_types.hpp" +#include "src/buildtool/common/protocol_traits.hpp" auto ArtifactDigestFactory::Create(HashFunction::Type hash_type, std::string hash, std::size_t size, bool is_tree) noexcept -> expected { - const bool kTreesAllowed = hash_type == HashFunction::Type::GitSHA1; auto hash_info = - HashInfo::Create(hash_type, std::move(hash), kTreesAllowed and is_tree); + HashInfo::Create(hash_type, + std::move(hash), + ProtocolTraits::IsTreeAllowed(hash_type) and is_tree); if (not hash_info) { return unexpected{std::move(hash_info).error()}; } -- cgit v1.2.3