From 4625d391cad4d04f9adca4484da687b2adb1fed6 Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Tue, 25 Jun 2024 16:14:51 +0200 Subject: Use a raw pointer for passing optional IExecutionApi ...instead of std::optional> --- src/other_tools/root_maps/commit_git_map.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/other_tools/root_maps/commit_git_map.cpp') diff --git a/src/other_tools/root_maps/commit_git_map.cpp b/src/other_tools/root_maps/commit_git_map.cpp index a4f2b8eb..65585afc 100644 --- a/src/other_tools/root_maps/commit_git_map.cpp +++ b/src/other_tools/root_maps/commit_git_map.cpp @@ -62,7 +62,7 @@ void EnsureRootAsAbsent(std::string const& tree_id, std::filesystem::path const& repo_root, GitRepoInfo const& repo_info, std::optional const& serve, - IExecutionApi::OptionalPtr const& remote_api, + IExecutionApi const* remote_api, CommitGitMap::SetterPtr const& ws_setter, CommitGitMap::LoggerPtr const& logger) { // this is an absent root @@ -103,7 +103,7 @@ void EnsureRootAsAbsent(std::string const& tree_id, /*fatal=*/true); return; } - if (not remote_api) { + if (remote_api == nullptr) { (*logger)( fmt::format("Missing or incompatible remote-execution " "endpoint needed to sync workspace root {} " @@ -117,7 +117,7 @@ void EnsureRootAsAbsent(std::string const& tree_id, if (not EnsureAbsentRootOnServe(*serve, tree_id, repo_root, - &(*remote_api.value()), + remote_api, logger, true /*no_sync_is_fatal*/)) { return; @@ -411,7 +411,7 @@ void EnsureCommit(GitRepoInfo const& repo_info, std::vector const& launcher, std::optional const& serve, gsl::not_null const& local_api, - IExecutionApi::OptionalPtr const& remote_api, + IExecutionApi const* remote_api, bool fetch_absent, gsl::not_null const& ts, CommitGitMap::SetterPtr const& ws_setter, @@ -716,8 +716,8 @@ void EnsureCommit(GitRepoInfo const& repo_info, // try to get root tree from remote CAS auto root_digest = ArtifactDigest{ root_tree_id, 0, /*is_tree=*/true}; - if (remote_api and - remote_api.value()->RetrieveToCas( + if (remote_api != nullptr and + remote_api->RetrieveToCas( {Artifact::ObjectInfo{ .digest = root_digest, .type = ObjectType::Tree}}, @@ -923,7 +923,7 @@ auto CreateCommitGitMap( std::vector const& launcher, std::optional const& serve, gsl::not_null const& local_api, - IExecutionApi::OptionalPtr const& remote_api, + IExecutionApi const* remote_api, bool fetch_absent, std::size_t jobs) -> CommitGitMap { auto commit_to_git = [critical_git_op_map, -- cgit v1.2.3