summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/git_cas.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/file_system/git_cas.hpp')
-rw-r--r--src/buildtool/file_system/git_cas.hpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/buildtool/file_system/git_cas.hpp b/src/buildtool/file_system/git_cas.hpp
index 44b61cb4..f95cb403 100644
--- a/src/buildtool/file_system/git_cas.hpp
+++ b/src/buildtool/file_system/git_cas.hpp
@@ -18,6 +18,7 @@
#include <filesystem>
#include <memory>
#include <optional>
+#include <shared_mutex>
#include <unordered_map>
#include <vector>
@@ -67,6 +68,11 @@ class GitCAS {
// git folder path of repo
std::filesystem::path git_path_{};
+ // mutex to guard odb while setting up a "fake" repository; it needs to be
+ // uniquely owned while wrapping the odb, but then git operations are free
+ // to share it.
+ mutable std::shared_mutex mutex_{};
+
[[nodiscard]] auto OpenODB(std::filesystem::path const& repo_path) noexcept
-> bool;