diff options
Diffstat (limited to 'src/other_tools/root_maps/commit_git_map.cpp')
-rw-r--r-- | src/other_tools/root_maps/commit_git_map.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/other_tools/root_maps/commit_git_map.cpp b/src/other_tools/root_maps/commit_git_map.cpp index a8ef5eaf..18d80aa7 100644 --- a/src/other_tools/root_maps/commit_git_map.cpp +++ b/src/other_tools/root_maps/commit_git_map.cpp @@ -79,10 +79,9 @@ void EnsureRootAsAbsent(std::string const& tree_id, serve->RetrieveTreeFromCommit(repo_info.hash, repo_info.subdir, /*sync_tree = */ false); - if (std::holds_alternative<std::string>(serve_result)) { + if (serve_result) { // if serve has set up the tree, it must match what we expect - auto const& served_tree_id = - std::get<std::string>(serve_result); + auto const& served_tree_id = *serve_result; if (tree_id != served_tree_id) { (*logger)(fmt::format("Mismatch in served root tree " "id:\nexpected {}, but got {}", @@ -95,8 +94,7 @@ void EnsureRootAsAbsent(std::string const& tree_id, else { // check if serve failure was due to commit not being found or // it is otherwise fatal - auto const& is_fatal = std::get<bool>(serve_result); - if (is_fatal) { + if (serve_result.error() == GitLookupError::Fatal) { (*logger)(fmt::format("Serve endpoint failed to set up " "root from known commit {}", repo_info.hash), @@ -515,7 +513,7 @@ void EnsureCommit(GitRepoInfo const& repo_info, serve->RetrieveTreeFromCommit(repo_info.hash, repo_info.subdir, /*sync_tree = */ false); - if (std::holds_alternative<std::string>(serve_result)) { + if (serve_result) { // set the workspace root as absent JustMRProgress::Instance().TaskTracker().Stop( repo_info.origin); @@ -524,14 +522,13 @@ void EnsureCommit(GitRepoInfo const& repo_info, {repo_info.ignore_special ? FileRoot::kGitTreeIgnoreSpecialMarker : FileRoot::kGitTreeMarker, - std::get<std::string>(serve_result)}), + *std::move(serve_result)}), /*is_cache_hit=*/false)); return; } // check if serve failure was due to commit not being found or // it is otherwise fatal - auto const& is_fatal = std::get<bool>(serve_result); - if (is_fatal) { + if (serve_result.error() == GitLookupError::Fatal) { (*logger)(fmt::format("Serve endpoint failed to set up " "root from known commit {}", repo_info.hash), @@ -546,9 +543,8 @@ void EnsureCommit(GitRepoInfo const& repo_info, serve->RetrieveTreeFromCommit(repo_info.hash, /*subdir = */ ".", /*sync_tree = */ true); - if (std::holds_alternative<std::string>(serve_result)) { - auto const& root_tree_id = - std::get<std::string>(serve_result); + if (serve_result) { + auto const& root_tree_id = *serve_result; // verify if we know the tree already in the local Git cache GitOpKey op_key = { .params = @@ -845,8 +841,7 @@ void EnsureCommit(GitRepoInfo const& repo_info, // check if serve failure was due to commit not being found // or it is otherwise fatal - auto const& is_fatal = std::get<bool>(serve_result); - if (is_fatal) { + if (serve_result.error() == GitLookupError::Fatal) { (*logger)(fmt::format("Serve endpoint failed to set up " "root from known commit {}", repo_info.hash), |