diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-09-11 10:21:13 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-09-13 14:41:00 +0200 |
commit | ddf48a60029bed958fb2cf0238dbb0bca0b770fb (patch) | |
tree | 6c42568d14624a36a4f9b07d578d2a001764065d /src/buildtool/common/artifact_digest_factory.cpp | |
parent | f60d39620b29aeaf1addeb244bdd6e15ddf4894c (diff) | |
download | justbuild-ddf48a60029bed958fb2cf0238dbb0bca0b770fb.tar.gz |
Add to ProtocolTraits static functions that provide protocol-specific behaviour
Diffstat (limited to 'src/buildtool/common/artifact_digest_factory.cpp')
-rw-r--r-- | src/buildtool/common/artifact_digest_factory.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
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<ArtifactDigest, std::string> { - 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()}; } |