From 4fe5fc8aec6e391a5e300e234bdc41375bff1d9e Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Fri, 5 Apr 2024 11:48:13 +0200 Subject: resolve_symlinks_map: Allow separate source and target repositories In certain cases, e.g., on the serve endpoint, an unresolved tree might lie in a repository other than the Git cache, therefore we cannot create any new entries there, as it would violate our guarantee that we only write under our local build root. Therefore, the resolve_symlinks_map now receives pointers to both the source and target Git databases and ensures that: 1. any tree created on-the-fly is stored exclusively in the target repository, and 2. any other entry required for those trees is made available in the target repository by copying it from the source repository. Note that in our use case the target repository is always our Git cache and passing a pointer to that object database is done to avoid the overhead of otherwise opening the database very often. --- src/buildtool/serve_api/serve_service/source_tree.hpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/buildtool/serve_api/serve_service/source_tree.hpp') diff --git a/src/buildtool/serve_api/serve_service/source_tree.hpp b/src/buildtool/serve_api/serve_service/source_tree.hpp index f2585f40..d8d117e0 100644 --- a/src/buildtool/serve_api/serve_service/source_tree.hpp +++ b/src/buildtool/serve_api/serve_service/source_tree.hpp @@ -173,9 +173,12 @@ class SourceTreeService final ServeArchiveTreeResponse* response) -> ::grpc::Status; + /// \brief Resolves a tree from given repository with respect to symlinks. + /// The resolved tree will always be placed in the Git cache. [[nodiscard]] auto ResolveContentTree( std::string const& tree_id, std::filesystem::path const& repo_path, + bool repo_is_git_cache, std::optional const& resolve_special, bool sync_tree, ServeArchiveTreeResponse* response) -> ::grpc::Status; -- cgit v1.2.3