From 0afacdb938a9787151f338656fa943679b7ec68b Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Wed, 24 Jul 2024 10:16:34 +0200 Subject: Pass SymlinksCheckFunc to GitRepo as not_null + invoke it only if there are symlinks to check + remove the corresponding runtime check since it is replaced by a compile-time check --- src/buildtool/file_system/git_repo.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/buildtool/file_system/git_repo.hpp') diff --git a/src/buildtool/file_system/git_repo.hpp b/src/buildtool/file_system/git_repo.hpp index 95fa14a6..1e5ec839 100644 --- a/src/buildtool/file_system/git_repo.hpp +++ b/src/buildtool/file_system/git_repo.hpp @@ -23,6 +23,7 @@ #include // std::move #include +#include "gsl/gsl" #include "src/buildtool/common/bazel_types.hpp" #include "src/buildtool/file_system/git_cas.hpp" #include "src/buildtool/file_system/git_types.hpp" @@ -107,10 +108,11 @@ class GitRepo { /// \param check_symlinks Function to check non-upwardness condition. /// \param is_hex_id Specify whether `id` is hex string or raw. /// \param ignore_special If set, treat symlinks as absent. - [[nodiscard]] auto ReadTree(std::string const& id, - SymlinksCheckFunc const& check_symlinks, - bool is_hex_id = false, - bool ignore_special = false) const noexcept + [[nodiscard]] auto ReadTree( + std::string const& id, + gsl::not_null const& check_symlinks, + bool is_hex_id = false, + bool ignore_special = false) const noexcept -> std::optional; /// \brief Create a flat tree from entries and store tree in CAS. @@ -132,7 +134,7 @@ class GitRepo { [[nodiscard]] static auto ReadTreeData( std::string const& data, std::string const& id, - SymlinksCheckFunc const& check_symlinks, + gsl::not_null const& check_symlinks, bool is_hex_id = false) noexcept -> std::optional; /// \brief Create a flat shallow (without objects in db) tree and return it. -- cgit v1.2.3