summaryrefslogtreecommitdiff
path: root/src/buildtool/serve_api/serve_service/source_tree.hpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2025-01-07 16:13:29 +0100
committerKlaus Aehlig <klaus.aehlig@huawei.com>2025-01-13 16:22:13 +0100
commit43a8afd25367190a15942fa47bfef1ed06b2b4cf (patch)
tree552c520f3d098db7d8f317b86cbddcf7dea07ed8 /src/buildtool/serve_api/serve_service/source_tree.hpp
parentea4c45e02f3b8e7015baa65ecdb10fbbc49df1fc (diff)
downloadjustbuild-43a8afd25367190a15942fa47bfef1ed06b2b4cf.tar.gz
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)
Diffstat (limited to 'src/buildtool/serve_api/serve_service/source_tree.hpp')
-rw-r--r--src/buildtool/serve_api/serve_service/source_tree.hpp6
1 files changed, 6 insertions, 0 deletions
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 <type_traits>
#include <unordered_map>
#include <utility>
+#include <variant>
#include <vector>
#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<std::monostate, std::string>;
+
/// \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).