diff options
Diffstat (limited to 'src/buildtool/file_system/object_cas.hpp')
-rw-r--r-- | src/buildtool/file_system/object_cas.hpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/buildtool/file_system/object_cas.hpp b/src/buildtool/file_system/object_cas.hpp index 2af59bb9..e7cd7f1b 100644 --- a/src/buildtool/file_system/object_cas.hpp +++ b/src/buildtool/file_system/object_cas.hpp @@ -113,9 +113,11 @@ class ObjectCAS { [[nodiscard]] static auto CreateDigest( std::filesystem::path const& file_path) noexcept -> std::optional<bazel_re::Digest> { - auto const bytes = FileSystemManager::ReadFile(file_path); - if (bytes.has_value()) { - return ArtifactDigest::Create<kType>(*bytes); + bool is_tree = kType == ObjectType::Tree; + auto hash = HashFunction::ComputeHashFile(file_path, is_tree); + if (hash) { + return ArtifactDigest( + hash->first.HexString(), hash->second, is_tree); } return std::nullopt; } |