summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/git_repo.hpp
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-12-04 14:34:12 +0100
committerMaksim Denisov <denisov.maksim@huawei.com>2024-12-05 11:08:08 +0100
commit31ce2ad2b7457147621c5aa104c677754b37d11d (patch)
tree767da7b57097df1859223edad960d7a57c83de73 /src/buildtool/file_system/git_repo.hpp
parent7b50ad08180edb160d023ed61518cd9256f65f70 (diff)
downloadjustbuild-31ce2ad2b7457147621c5aa104c677754b37d11d.tar.gz
GitRepo: don't reassign git_repository to git_odb
...and remove GuardedRepo.
Diffstat (limited to 'src/buildtool/file_system/git_repo.hpp')
-rw-r--r--src/buildtool/file_system/git_repo.hpp33
1 files changed, 2 insertions, 31 deletions
diff --git a/src/buildtool/file_system/git_repo.hpp b/src/buildtool/file_system/git_repo.hpp
index d95e5710..8fb65379 100644
--- a/src/buildtool/file_system/git_repo.hpp
+++ b/src/buildtool/file_system/git_repo.hpp
@@ -19,7 +19,6 @@
#include <functional>
#include <memory>
#include <optional>
-#include <shared_mutex>
#include <string>
#include <unordered_map>
#include <utility> // std::move
@@ -317,37 +316,9 @@ class GitRepo {
-> std::shared_ptr<git_config>;
private:
- /// \brief Wrapped git_repository with guarded destructor.
- /// Kept privately nested to avoid misuse of its raw pointer members.
- class GuardedRepo {
- public:
- GuardedRepo() noexcept = delete;
- explicit GuardedRepo(std::shared_mutex* mutex) noexcept;
- ~GuardedRepo() noexcept;
-
- // prohibit moves and copies
- GuardedRepo(GuardedRepo const&) = delete;
- GuardedRepo(GuardedRepo&& other) = delete;
- auto operator=(GuardedRepo const&) = delete;
- auto operator=(GuardedRepo&& other) = delete;
-
- // get the bare pointer
- [[nodiscard]] auto Ptr() -> git_repository*;
- [[nodiscard]] auto PtrRef() -> git_repository**;
-
- private:
- std::shared_mutex* mutex_;
- git_repository* repo_{nullptr};
- };
-
- using GuardedRepoPtr = std::shared_ptr<GuardedRepo>;
-
- // IMPORTANT! The GitCAS object must be defined before the repo object to
- // keep the GitContext alive until cleanup ends.
- GitCASPtr git_cas_{nullptr};
- GuardedRepoPtr repo_{nullptr};
+ GitCASPtr git_cas_;
// default to real repo, as that is non-thread-safe
- bool is_repo_fake_{false};
+ bool is_repo_fake_;
protected:
/// \brief Open "fake" repository wrapper for existing CAS.