From 43a8afd25367190a15942fa47bfef1ed06b2b4cf Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Tue, 7 Jan 2025 16:13:29 +0100 Subject: source tree service: Ensure the Git cache exists Similarly to just-mr, each SourceTree RPC must ensure that the Git cache folder exists and the Git cache repository is initialized before using it. While there, fix missing shared locks on the Git cache root. (cherry-picked from 82340791f4362a3a92ea1dfa9ff111c1258be19f) --- src/buildtool/serve_api/serve_service/source_tree.hpp | 6 ++++++ 1 file changed, 6 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 24ef59c2..2989d65a 100644 --- a/src/buildtool/serve_api/serve_service/source_tree.hpp +++ b/src/buildtool/serve_api/serve_service/source_tree.hpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "gsl/gsl" @@ -142,6 +143,11 @@ class SourceTreeService final // symlinks resolver map ResolveSymlinksMap resolve_symlinks_map_{CreateResolveSymlinksMap()}; + /// \brief Ensure that the Git cache repository exists. + /// \returns Error message on failure. + [[nodiscard]] auto EnsureGitCacheRoot() + -> expected; + /// \brief Check if commit exists and tries to get the subtree if found. /// \returns The subtree hash on success or an unexpected error (fatal or /// commit was not found). -- cgit v1.2.3