From 3a771602f8ee6c7940208d447463061aa9b6af8c Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Thu, 29 Aug 2024 11:55:07 +0200 Subject: Return the IsTree flag from ArtifactDigest ...and replace obvious redundant conversions to bazel_re::Digest, which were done to ensure that the digest represents a tree. --- src/buildtool/execution_api/local/local_api.hpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/buildtool/execution_api/local/local_api.hpp') diff --git a/src/buildtool/execution_api/local/local_api.hpp b/src/buildtool/execution_api/local/local_api.hpp index eadf45b7..59dc1880 100644 --- a/src/buildtool/execution_api/local/local_api.hpp +++ b/src/buildtool/execution_api/local/local_api.hpp @@ -33,7 +33,6 @@ #include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/common/repository_config.hpp" #include "src/buildtool/compatibility/compatibility.hpp" -#include "src/buildtool/compatibility/native_support.hpp" #include "src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp" #include "src/buildtool/execution_api/common/artifact_blob_container.hpp" #include "src/buildtool/execution_api/common/blob_tree.hpp" @@ -262,8 +261,7 @@ class LocalApi final : public IExecutionApi { bool /*skip_find_missing*/) const noexcept -> bool final { for (auto const& blob : blobs.Blobs()) { - auto const is_tree = NativeSupport::IsTree( - static_cast(blob.digest).hash()); + auto const is_tree = blob.digest.IsTree(); auto cas_digest = is_tree ? local_context_.storage->CAS().StoreTree(*blob.data) : local_context_.storage->CAS().StoreBlob(*blob.data, @@ -308,7 +306,7 @@ class LocalApi final : public IExecutionApi { [[nodiscard]] auto IsAvailable(ArtifactDigest const& digest) const noexcept -> bool final { return static_cast( - NativeSupport::IsTree(static_cast(digest).hash()) + digest.IsTree() ? local_context_.storage->CAS().TreePath(digest) : local_context_.storage->CAS().BlobPath(digest, false)); } @@ -317,9 +315,8 @@ class LocalApi final : public IExecutionApi { const noexcept -> std::vector final { std::vector result; for (auto const& digest : digests) { - auto const& path = - NativeSupport::IsTree( - static_cast(digest).hash()) + auto const path = + digest.IsTree() ? local_context_.storage->CAS().TreePath(digest) : local_context_.storage->CAS().BlobPath(digest, false); if (not path) { -- cgit v1.2.3