From 4368bf026fa7d18d2c01ac18cdb3e9ff6a228221 Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Mon, 8 Jul 2024 15:07:24 +0200 Subject: Use a fixed HashFunction for reading trees --- src/buildtool/execution_api/common/tree_reader_utils.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/buildtool/execution_api/common/tree_reader_utils.cpp') diff --git a/src/buildtool/execution_api/common/tree_reader_utils.cpp b/src/buildtool/execution_api/common/tree_reader_utils.cpp index 874d1884..acd24108 100644 --- a/src/buildtool/execution_api/common/tree_reader_utils.cpp +++ b/src/buildtool/execution_api/common/tree_reader_utils.cpp @@ -40,11 +40,13 @@ namespace { : ObjectType::File}; } -[[nodiscard]] auto CreateObjectInfo(bazel_re::SymlinkNode const& node) +[[nodiscard]] auto CreateObjectInfo(bazel_re::SymlinkNode const& node, + HashFunction hash_function) -> Artifact::ObjectInfo { + return Artifact::ObjectInfo{ - .digest = ArtifactDigest::Create( - HashFunction::Instance(), node.target()), + .digest = ArtifactDigest::Create(hash_function, + node.target()), .type = ObjectType::Symlink}; } @@ -87,8 +89,11 @@ auto TreeReaderUtils::ReadObjectInfos(bazel_re::Directory const& dir, return false; } } + + // SHA256 is used since bazel types are processed here. + HashFunction const hash_function{HashFunction::JustHash::Compatible}; for (auto const& l : dir.symlinks()) { - if (not store_info(l.name(), CreateObjectInfo(l))) { + if (not store_info(l.name(), CreateObjectInfo(l, hash_function))) { return false; } } -- cgit v1.2.3