summaryrefslogtreecommitdiff
path: root/src/other_tools/git_operations/git_repo_remote.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/other_tools/git_operations/git_repo_remote.cpp')
-rw-r--r--src/other_tools/git_operations/git_repo_remote.cpp38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/other_tools/git_operations/git_repo_remote.cpp b/src/other_tools/git_operations/git_repo_remote.cpp
index f3a2479f..15740b99 100644
--- a/src/other_tools/git_operations/git_repo_remote.cpp
+++ b/src/other_tools/git_operations/git_repo_remote.cpp
@@ -155,12 +155,13 @@ auto GitRepoRemote::GetCommitFromRemote(std::shared_ptr<git_config> cfg,
}
// create remote
git_remote* remote_ptr{nullptr};
- if (git_remote_create_anonymous(
- &remote_ptr, &GetGitRepository(), repo_url.c_str()) != 0) {
+ if (git_remote_create_anonymous(&remote_ptr,
+ GetGitCAS()->GetRepository(),
+ repo_url.c_str()) != 0) {
(*logger)(
fmt::format("Creating anonymous remote for git repository {} "
"failed with:\n{}",
- GetGitPath().string(),
+ GetGitCAS()->GetPath().string(),
GitLastError()),
true /*fatal*/);
git_remote_free(remote_ptr);
@@ -226,7 +227,7 @@ auto GitRepoRemote::GetCommitFromRemote(std::shared_ptr<git_config> cfg,
fmt::format("Connecting to remote {} for git repository {} "
"failed with:\n{}",
repo_url,
- GetGitPath().string(),
+ GetGitCAS()->GetPath().string(),
GitLastError()),
true /*fatal*/);
return std::nullopt;
@@ -286,12 +287,13 @@ auto GitRepoRemote::FetchFromRemote(std::shared_ptr<git_config> cfg,
}
// create remote from repo
git_remote* remote_ptr{nullptr};
- if (git_remote_create_anonymous(
- &remote_ptr, &GetGitRepository(), repo_url.c_str()) != 0) {
+ if (git_remote_create_anonymous(&remote_ptr,
+ GetGitCAS()->GetRepository(),
+ repo_url.c_str()) != 0) {
(*logger)(fmt::format("Creating remote {} for git repository {} "
"failed with:\n{}",
repo_url,
- GetGitPath().string(),
+ GetGitCAS()->GetPath().string(),
GitLastError()),
true /*fatal*/);
// cleanup resources
@@ -308,8 +310,8 @@ auto GitRepoRemote::FetchFromRemote(std::shared_ptr<git_config> cfg,
if (not cfg) {
// get config snapshot of current repo
git_config* cfg_ptr{nullptr};
- if (git_repository_config_snapshot(&cfg_ptr, &GetGitRepository()) !=
- 0) {
+ if (git_repository_config_snapshot(
+ &cfg_ptr, GetGitCAS()->GetRepository()) != 0) {
(*logger)(fmt::format("Retrieving config object in fetch from "
"remote failed with:\n{}",
GitLastError()),
@@ -379,7 +381,7 @@ auto GitRepoRemote::FetchFromRemote(std::shared_ptr<git_config> cfg,
fmt::format("Fetching{} in git repository {} failed "
"with:\n{}",
branch ? fmt::format(" branch {}", *branch) : "",
- GetGitPath().string(),
+ GetGitCAS()->GetPath().string(),
GitLastError()),
true /*fatal*/);
return false;
@@ -463,11 +465,11 @@ auto GitRepoRemote::UpdateCommitViaTmpRepo(
}
// set up the system command
SystemCommand system{repo_url};
- auto const exit_code =
- system.Execute(cmdline,
- env,
- GetGitPath(), // which path is not actually relevant
- tmp_path);
+ auto const exit_code = system.Execute(
+ cmdline,
+ env,
+ GetGitCAS()->GetPath(), // which path is not actually relevant
+ tmp_path);
if (not exit_code) {
(*logger)(fmt::format("exec() on command failed."),
@@ -566,9 +568,9 @@ auto GitRepoRemote::FetchViaTmpRepo(StorageConfig const& storage_config,
}
// add backend, with max priority
FetchIntoODBBackend b{.parent = kFetchIntoODBParent,
- .target_odb = &GetGitOdb()};
+ .target_odb = GetGitCAS()->GetODB()};
if (git_odb_add_backend(
- &tmp_repo->GetGitOdb(),
+ tmp_repo->GetGitCAS()->GetODB(),
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<git_odb_backend*>(&b),
std::numeric_limits<int>::max()) == 0) {
@@ -624,7 +626,7 @@ auto GitRepoRemote::FetchViaTmpRepo(StorageConfig const& storage_config,
// run command
SystemCommand system{repo_url};
auto const exit_code =
- system.Execute(cmdline, env, GetGitPath(), tmp_path);
+ system.Execute(cmdline, env, GetGitCAS()->GetPath(), tmp_path);
if (not exit_code) {
(*logger)(fmt::format("exec() on command failed."),