diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2024-06-27 17:44:34 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2024-06-28 11:34:53 +0200 |
commit | 01d9abcfc85d974763c3a7f8fed998342d92a681 (patch) | |
tree | 105a887360a49dfa8bf942f48c5560d29b0dcd6e /src/other_tools/root_maps/distdir_git_map.cpp | |
parent | f82ee35bff7363e6381d659b26773f260109e2ea (diff) | |
download | justbuild-01d9abcfc85d974763c3a7f8fed998342d92a681.tar.gz |
Use (un)expected for serve API
Diffstat (limited to 'src/other_tools/root_maps/distdir_git_map.cpp')
-rw-r--r-- | src/other_tools/root_maps/distdir_git_map.cpp | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/src/other_tools/root_maps/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp index 46a2b9bf..5371b359 100644 --- a/src/other_tools/root_maps/distdir_git_map.cpp +++ b/src/other_tools/root_maps/distdir_git_map.cpp @@ -203,12 +203,10 @@ auto CreateDistdirGitMap( serve->RetrieveTreeFromDistdir( key.content_list, /*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 (distdir_tree_id != served_tree_id) { (*logger)( fmt::format( @@ -224,9 +222,8 @@ auto CreateDistdirGitMap( // check if serve failure was due to distdir // content 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 " @@ -351,11 +348,10 @@ auto CreateDistdirGitMap( auto serve_result = serve->RetrieveTreeFromDistdir(key.content_list, /*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 " @@ -374,8 +370,7 @@ auto CreateDistdirGitMap( } // check if serve failure was due to distdir content 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 distdir content {}", @@ -487,11 +482,10 @@ auto CreateDistdirGitMap( auto serve_result = serve->RetrieveTreeFromDistdir(key.content_list, /*sync_tree=*/true); - 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 {}", @@ -507,8 +501,7 @@ auto CreateDistdirGitMap( else { // check if serve failure was due to distdir content 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 distdir content {}", |