diff options
Diffstat (limited to 'src/buildtool/execution_api/local/local_api.hpp')
-rw-r--r-- | src/buildtool/execution_api/local/local_api.hpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/buildtool/execution_api/local/local_api.hpp b/src/buildtool/execution_api/local/local_api.hpp index c04e82f4..f919e9c9 100644 --- a/src/buildtool/execution_api/local/local_api.hpp +++ b/src/buildtool/execution_api/local/local_api.hpp @@ -24,6 +24,7 @@ #include "fmt/core.h" #include "gsl/gsl" +#include "src/buildtool/common/repository_config.hpp" #include "src/buildtool/compatibility/compatibility.hpp" #include "src/buildtool/compatibility/native_support.hpp" #include "src/buildtool/execution_api/bazel_msg/bazel_blob.hpp" @@ -38,6 +39,10 @@ /// \brief API for local execution. class LocalApi final : public IExecutionApi { public: + explicit LocalApi(std::optional<gsl::not_null<RepositoryConfig*>> + repo_config = std::nullopt) + : repo_config_{std::move(repo_config)} {} + auto CreateAction( ArtifactDigest const& root_digest, std::vector<std::string> const& command, @@ -74,12 +79,13 @@ class LocalApi final : public IExecutionApi { info.digest, output_paths[i]); if (not infos) { if (Compatibility::IsCompatible()) { - // infos not availablble, and in compatible mode cannot + // infos not available, and in compatible mode cannot // fall back to git return false; } - if (not GitApi().RetrieveToPaths({info}, - {output_paths[i]})) { + if (repo_config_ and + not GitApi(repo_config_.value()) + .RetrieveToPaths({info}, {output_paths[i]})) { return false; } } @@ -92,12 +98,13 @@ class LocalApi final : public IExecutionApi { info.digest, IsExecutableObject(info.type)); if (not blob_path) { if (Compatibility::IsCompatible()) { - // infos not availablble, and in compatible mode cannot + // infos not available, and in compatible mode cannot // fall back to git return false; } - if (not GitApi().RetrieveToPaths({info}, - {output_paths[i]})) { + if (repo_config_ and + not GitApi(repo_config_.value()) + .RetrieveToPaths({info}, {output_paths[i]})) { return false; } } @@ -140,11 +147,13 @@ class LocalApi final : public IExecutionApi { info.ToString(), fd); if (Compatibility::IsCompatible()) { - // infos not availablble, and in compatible mode cannot + // infos not available, and in compatible mode cannot // fall back to git return false; } - if (not GitApi().RetrieveToFds({info}, {fd}, raw_tree)) { + if (repo_config_ and + not GitApi(repo_config_.value()) + .RetrieveToFds({info}, {fd}, raw_tree)) { return false; } } @@ -413,6 +422,7 @@ class LocalApi final : public IExecutionApi { } private: + std::optional<gsl::not_null<RepositoryConfig*>> repo_config_{}; gsl::not_null<Storage const*> storage_ = &Storage::Instance(); }; |