diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-12-04 14:34:12 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-01-13 16:21:58 +0100 |
commit | a98612a9a06ae2d3c5f59b34f6632d4f88137f04 (patch) | |
tree | 32cef831b647458e4e03476b8cac124d07df4f89 /src/buildtool/file_system/git_repo.hpp | |
parent | d045a283e324d50dec41d70703aa33c3884a8891 (diff) | |
download | justbuild-a98612a9a06ae2d3c5f59b34f6632d4f88137f04.tar.gz |
GitRepo: don't reassign git_repository to git_odb
...and remove GuardedRepo.
(cherry-picked from d9f39250d302152d19a0aacd76eabae7a013f1a8)
Diffstat (limited to 'src/buildtool/file_system/git_repo.hpp')
-rw-r--r-- | src/buildtool/file_system/git_repo.hpp | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/src/buildtool/file_system/git_repo.hpp b/src/buildtool/file_system/git_repo.hpp index 2d5f4df1..223dceb1 100644 --- a/src/buildtool/file_system/git_repo.hpp +++ b/src/buildtool/file_system/git_repo.hpp @@ -313,37 +313,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. |