diff options
Diffstat (limited to 'src/other_tools/root_maps/distdir_git_map.cpp')
-rw-r--r-- | src/other_tools/root_maps/distdir_git_map.cpp | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/src/other_tools/root_maps/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp index 49329908..213b4f94 100644 --- a/src/other_tools/root_maps/distdir_git_map.cpp +++ b/src/other_tools/root_maps/distdir_git_map.cpp @@ -147,7 +147,6 @@ auto CreateDistdirGitMap( gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, ServeApi const* serve, gsl::not_null<StorageConfig const*> const& native_storage_config, - StorageConfig const* compat_storage_config, gsl::not_null<Storage const*> const& native_storage, gsl::not_null<IExecutionApi const*> const& local_api, IExecutionApi const* remote_api, @@ -157,7 +156,6 @@ auto CreateDistdirGitMap( critical_git_op_map, serve, native_storage_config, - compat_storage_config, native_storage, local_api, remote_api](auto ts, @@ -197,9 +195,6 @@ auto CreateDistdirGitMap( key, serve, native_storage_config, - compat_storage_config, - local_api, - remote_api, setter, logger](auto const& values) { GitOpValue op_result = *values[0]; @@ -255,31 +250,29 @@ auto CreateDistdirGitMap( /*fatal=*/true); return; } - if (remote_api == nullptr) { - (*logger)( - fmt::format( - "Missing or incompatible " - "remote-execution endpoint " - "needed to sync workspace root " - "{} with the serve endpoint.", - distdir_tree_id), - /*fatal=*/true); + + auto digest = ArtifactDigestFactory::Create( + HashFunction::Type::GitSHA1, + distdir_tree_id, + /*size_unknown=*/0, + /*is_tree=*/true); + if (not digest.has_value()) { + (*logger)(std::move(digest).error(), + /*fatal=*/true); return; } + // the tree is known locally, so we upload // it to remote CAS for the serve endpoint // to retrieve it and set up the root - if (not EnsureAbsentRootOnServe( - *serve, - distdir_tree_id, - native_storage_config - ->GitRoot(), /*repo_root*/ - native_storage_config, - compat_storage_config, - &*local_api, - remote_api, - logger, - true /*no_sync_is_fatal*/)) { + auto uploaded = serve->UploadTree( + *digest, + native_storage_config->GitRoot()); + if (not uploaded.has_value()) { + (*logger)(std::move(uploaded) + .error() + .Message(), + /*fatal=*/true); return; } } |