diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-05-19 17:55:40 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-06-04 14:34:44 +0200 |
commit | ab7adbb24384387a5c46a6340ecdedc4c1481079 (patch) | |
tree | 11a696741dfdf2be32b2633a1e9b3bd90b24b793 /src/buildtool/tree_structure/tree_structure_utils.cpp | |
parent | dd9fa2841fcb5983b4ea845d5f9dc1b635d8dd18 (diff) | |
download | justbuild-ab7adbb24384387a5c46a6340ecdedc4c1481079.tar.gz |
Remove unneeded extra checks for upwards symlinks
Diffstat (limited to 'src/buildtool/tree_structure/tree_structure_utils.cpp')
-rw-r--r-- | src/buildtool/tree_structure/tree_structure_utils.cpp | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/buildtool/tree_structure/tree_structure_utils.cpp b/src/buildtool/tree_structure/tree_structure_utils.cpp index 758e47fc..b8b9dcc3 100644 --- a/src/buildtool/tree_structure/tree_structure_utils.cpp +++ b/src/buildtool/tree_structure/tree_structure_utils.cpp @@ -14,7 +14,6 @@ #include "src/buildtool/tree_structure/tree_structure_utils.hpp" -#include <algorithm> #include <cstddef> #include <filesystem> #include <functional> @@ -38,7 +37,6 @@ #include "src/buildtool/file_system/git_repo.hpp" #include "src/buildtool/file_system/object_type.hpp" #include "src/utils/cpp/hex_string.hpp" -#include "src/utils/cpp/path.hpp" #include "src/utils/cpp/tmp_dir.hpp" auto TreeStructureUtils::Compute(ArtifactDigest const& tree, @@ -65,22 +63,9 @@ auto TreeStructureUtils::Compute(ArtifactDigest const& tree, fmt::format("Failed to read content of: {}", tree.hash())}; } - auto const check_symlinks = - [&storage](std::vector<ArtifactDigest> const& ids) { - return std::all_of( - ids.begin(), ids.end(), [&storage](auto const& id) -> bool { - auto path_to_symlink = - storage.CAS().BlobPath(id, /*is_executable=*/false); - if (not path_to_symlink) { - return false; - } - auto const content = - FileSystemManager::ReadFile(*path_to_symlink); - return content and PathIsNonUpwards(*content); - }); - }; + auto skip_symlinks = [](auto const& /*unused*/) { return true; }; auto const entries = GitRepo::ReadTreeData( - *tree_content, tree.hash(), check_symlinks, /*is_hex_id=*/true); + *tree_content, tree.hash(), skip_symlinks, /*is_hex_id=*/true); if (not entries) { return unexpected{ fmt::format("Failed to parse git tree: {}", tree.hash())}; |