summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/git_cas.cpp
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2022-03-23 18:47:42 +0100
committerOliver Reiche <oliver.reiche@huawei.com>2022-03-23 20:07:51 +0100
commit7a05bb5cfbf3560b828c226f4a3bad8c3826b039 (patch)
treeed77169173b89492869c787533f27d0bfb95480f /src/buildtool/file_system/git_cas.cpp
parent45cba2778426601bdffbcfe6aa7310aee76a6e54 (diff)
downloadjustbuild-7a05bb5cfbf3560b828c226f4a3bad8c3826b039.tar.gz
Apply changes suggested by clang-tidy 11
Diffstat (limited to 'src/buildtool/file_system/git_cas.cpp')
-rw-r--r--src/buildtool/file_system/git_cas.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/buildtool/file_system/git_cas.cpp b/src/buildtool/file_system/git_cas.cpp
index e77d8d6e..67091d2f 100644
--- a/src/buildtool/file_system/git_cas.cpp
+++ b/src/buildtool/file_system/git_cas.cpp
@@ -1,5 +1,6 @@
#include "src/buildtool/file_system/git_cas.hpp"
+#include <mutex>
#include <sstream>
#include "src/buildtool/file_system/file_system_manager.hpp"
@@ -154,9 +155,10 @@ auto GitCAS::ReadHeader(std::string const& id, bool is_hex_id) const noexcept
}
auto GitCAS::OpenODB(std::filesystem::path const& repo_path) noexcept -> bool {
+ static std::mutex repo_mutex{};
if (initialized_) {
{ // lock as git_repository API has no thread-safety guarantees
- std::unique_lock lock{repo_mutex_};
+ std::unique_lock lock{repo_mutex};
git_repository* repo = nullptr;
if (git_repository_open(&repo, repo_path.c_str()) != 0) {
Logger::Log(LogLevel::Error,