summaryrefslogtreecommitdiff
path: root/src/other_tools/git_operations/git_operations.cpp
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-11-29 16:26:30 +0100
committerMaksim Denisov <denisov.maksim@huawei.com>2024-12-02 11:04:20 +0100
commite5df21209e665f03b57cfaa83707e30e14012097 (patch)
tree93e1b1dbf219ffc38d77c118c5ef04f80acd95b9 /src/other_tools/git_operations/git_operations.cpp
parente429d3f2905f1ba74d39a79d24eeefb408c8db92 (diff)
downloadjustbuild-e5df21209e665f03b57cfaa83707e30e14012097.tar.gz
Add aditional checks to initializations of git repos
Diffstat (limited to 'src/other_tools/git_operations/git_operations.cpp')
-rw-r--r--src/other_tools/git_operations/git_operations.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/other_tools/git_operations/git_operations.cpp b/src/other_tools/git_operations/git_operations.cpp
index e21e55d4..aacaf65e 100644
--- a/src/other_tools/git_operations/git_operations.cpp
+++ b/src/other_tools/git_operations/git_operations.cpp
@@ -44,7 +44,7 @@ auto CriticalGitOps::GitInitialCommit(GitOpParams const& crit_op_params,
// Create and open a GitRepoRemote at given target location
auto git_repo = GitRepoRemote::InitAndOpen(crit_op_params.target_path,
/*is_bare=*/false);
- if (git_repo == std::nullopt) {
+ if (git_repo == std::nullopt or git_repo->GetGitCAS() == nullptr) {
(*logger)(fmt::format("could not initialize git repository {}",
crit_op_params.target_path.string()),
true /*fatal*/);
@@ -83,7 +83,7 @@ auto CriticalGitOps::GitEnsureInit(GitOpParams const& crit_op_params,
auto git_repo = GitRepoRemote::InitAndOpen(
crit_op_params.target_path,
/*is_bare=*/crit_op_params.init_bare.value());
- if (git_repo == std::nullopt) {
+ if (git_repo == std::nullopt or git_repo->GetGitCAS() == nullptr) {
(*logger)(
fmt::format("could not initialize {} git repository {}",
crit_op_params.init_bare.value() ? "bare" : "non-bare",