diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/execution_api/common/tree_reader_utils.cpp | 13 | ||||
-rw-r--r-- | src/buildtool/execution_api/local/local_cas_reader.cpp | 5 |
2 files changed, 13 insertions, 5 deletions
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<ObjectType::File>( - HashFunction::Instance(), node.target()), + .digest = ArtifactDigest::Create<ObjectType::File>(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; } } diff --git a/src/buildtool/execution_api/local/local_cas_reader.cpp b/src/buildtool/execution_api/local/local_cas_reader.cpp index 504b4c74..397c02ad 100644 --- a/src/buildtool/execution_api/local/local_cas_reader.cpp +++ b/src/buildtool/execution_api/local/local_cas_reader.cpp @@ -58,9 +58,12 @@ auto LocalCasReader::ReadGitTree(ArtifactDigest const& digest) const noexcept } return true; }; + + // Git-SHA1 hashing is used for reading from git. + HashFunction const hash_function{HashFunction::JustHash::Native}; return GitRepo::ReadTreeData( *content, - HashFunction::Instance().ComputeTreeHash(*content).Bytes(), + hash_function.ComputeTreeHash(*content).Bytes(), check_symlinks, /*is_hex_id=*/false); } |