summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/common/artifact_digest.hpp9
-rw-r--r--src/buildtool/execution_api/local/local_api.hpp5
2 files changed, 12 insertions, 2 deletions
diff --git a/src/buildtool/common/artifact_digest.hpp b/src/buildtool/common/artifact_digest.hpp
index fdb4648e..d3f828af 100644
--- a/src/buildtool/common/artifact_digest.hpp
+++ b/src/buildtool/common/artifact_digest.hpp
@@ -22,10 +22,17 @@ class ArtifactDigest {
explicit ArtifactDigest(bazel_re::Digest const& digest) noexcept
: size_{gsl::narrow<std::size_t>(digest.size_bytes())},
hash_{NativeSupport::Unprefix(digest.hash())},
+ // In compatible mode, no tree information is stored in a digest,
+ // NativeSupport::IsTree will always return false in compatible mode.
is_tree_{NativeSupport::IsTree(digest.hash())} {}
ArtifactDigest(std::string hash, std::size_t size, bool is_tree) noexcept
- : size_{size}, hash_{std::move(hash)}, is_tree_{is_tree} {
+ : size_{size},
+ hash_{std::move(hash)},
+ // In compatible mode, no tree information is stored in a digest. This
+ // information is only relevant in native mode, since the hash needs
+ // to be prefixed accordingly.
+ is_tree_{not Compatibility::IsCompatible() and is_tree} {
gsl_ExpectsAudit(not NativeSupport::IsPrefixed(hash_));
}
diff --git a/src/buildtool/execution_api/local/local_api.hpp b/src/buildtool/execution_api/local/local_api.hpp
index 1a43fe4b..06388287 100644
--- a/src/buildtool/execution_api/local/local_api.hpp
+++ b/src/buildtool/execution_api/local/local_api.hpp
@@ -161,7 +161,10 @@ class LocalApi final : public IExecutionApi {
const noexcept -> std::vector<ArtifactDigest> final {
std::vector<ArtifactDigest> result;
for (auto const& digest : digests) {
- if (not storage_->BlobPath(digest, false).has_value()) {
+ auto const& path = digest.is_tree()
+ ? storage_->TreePath(digest)
+ : storage_->BlobPath(digest, false);
+ if (not path) {
result.push_back(digest);
}
}