diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-08-29 09:18:09 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-08-30 17:17:09 +0200 |
commit | dd12fcb5eea5970ac8ef6acd7a200c1e92ce81ea (patch) | |
tree | 1d7fcfb366f45ca11a908ecc90f3f55d4c2e6618 /src/buildtool/file_system/git_repo.cpp | |
parent | 98884d6d3f5c31efb3390ab75f1952dcdff0221c (diff) | |
download | justbuild-dd12fcb5eea5970ac8ef6acd7a200c1e92ce81ea.tar.gz |
Replace bazel_re::Digest in GitRepo::SymlinksCheckFunc callback
...with ArtifactDigest.
Diffstat (limited to 'src/buildtool/file_system/git_repo.cpp')
-rw-r--r-- | src/buildtool/file_system/git_repo.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/buildtool/file_system/git_repo.cpp b/src/buildtool/file_system/git_repo.cpp index c75029ee..b4c06224 100644 --- a/src/buildtool/file_system/git_repo.cpp +++ b/src/buildtool/file_system/git_repo.cpp @@ -22,7 +22,6 @@ #include <thread> #include <unordered_set> -#include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/logging/logger.hpp" @@ -1843,20 +1842,21 @@ auto GitRepo::ReadTree(std::string const& id, // ignore_special==false. if (not ignore_special) { // we first gather all symlink candidates - std::vector<bazel_re::Digest> symlinks{}; + // to check symlinks in bulk, optimized for network-backed repos + std::vector<ArtifactDigest> symlinks{}; symlinks.reserve(entries.size()); // at most one symlink per entry for (auto const& entry : entries) { - for (auto const& item : entry.second) { - if (IsSymlinkObject(item.type)) { - symlinks.emplace_back(bazel_re::Digest( - ArtifactDigest(ToHexString(entry.first), - /*size=*/0, - /*is_tree=*/false))); - break; // no need to check other items with same hash - } + if (std::any_of(entry.second.begin(), + entry.second.end(), + [](tree_entry_t const& item) { + return IsSymlinkObject(item.type); + })) { + symlinks.emplace_back(ToHexString(entry.first), + /*size=*/0, + /*is_tree=*/false); } } - // we check symlinks in bulk, optimized for network-backed repos + if (not symlinks.empty() and not std::invoke(check_symlinks.get(), symlinks)) { Logger::Log(LogLevel::Error, |