diff options
Diffstat (limited to 'src/buildtool/execution_api/common')
-rw-r--r-- | src/buildtool/execution_api/common/TARGETS | 3 | ||||
-rw-r--r-- | src/buildtool/execution_api/common/blob_tree.cpp | 19 |
2 files changed, 8 insertions, 14 deletions
diff --git a/src/buildtool/execution_api/common/TARGETS b/src/buildtool/execution_api/common/TARGETS index 6eeb3931..39ccc042 100644 --- a/src/buildtool/execution_api/common/TARGETS +++ b/src/buildtool/execution_api/common/TARGETS @@ -133,8 +133,7 @@ , ["src/buildtool/execution_api/bazel_msg", "directory_tree"] ] , "private-deps": - [ ["src/buildtool/common", "artifact_digest_factory"] - , ["src/buildtool/common", "common"] + [ ["src/buildtool/common", "common"] , ["src/buildtool/crypto", "hash_function"] , ["src/buildtool/file_system", "git_repo"] , ["src/buildtool/file_system", "object_type"] diff --git a/src/buildtool/execution_api/common/blob_tree.cpp b/src/buildtool/execution_api/common/blob_tree.cpp index 7224406a..e6d8fc2c 100644 --- a/src/buildtool/execution_api/common/blob_tree.cpp +++ b/src/buildtool/execution_api/common/blob_tree.cpp @@ -22,7 +22,6 @@ #include "src/buildtool/common/artifact.hpp" #include "src/buildtool/common/artifact_digest.hpp" -#include "src/buildtool/common/artifact_digest_factory.hpp" #include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/file_system/git_repo.hpp" #include "src/buildtool/file_system/object_type.hpp" @@ -68,17 +67,13 @@ auto BlobTree::FromDirectoryTree(DirectoryTreePtr const& tree, } } if (auto git_tree = GitRepo::CreateShallowTree(entries)) { - auto digest = - ArtifactDigestFactory::Create(HashFunction::Type::GitSHA1, - ToHexString(git_tree->first), - git_tree->second.size(), - /*is_tree=*/true); - if (digest) { - return std::make_shared<BlobTree>( - ArtifactBlob{*std::move(digest), - git_tree->second, - /*is_exec=*/false}, - nodes); + auto blob = ArtifactBlob::FromMemory( + HashFunction{HashFunction::Type::GitSHA1}, + ObjectType::Tree, + std::move(git_tree)->second); + if (blob.has_value()) { + return std::make_shared<BlobTree>(*std::move(blob), + std::move(nodes)); } } } catch (...) { |