diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-02-13 15:31:01 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-03-03 16:21:14 +0100 |
commit | 91f33def73223721ad91f99040158f3ff54dffab (patch) | |
tree | 1781e6e22ff169fafc81697d6502bc9dc9f396cb /src/other_tools/git_operations/git_repo_remote.hpp | |
parent | cab6734ee8d6ffc5a001144aead0ce6c79c90048 (diff) | |
download | justbuild-91f33def73223721ad91f99040158f3ff54dffab.tar.gz |
GitRepoRemote: Correctly honor SSL certification settings in fetch and commit update
Uses the SSL certification utility method to correctly set the
certification check options for the remote URL libgit2 calls.
Due to the fact that remote operations are done via a temporary
repository to allow concurrent work, the correct repository
configuration needs to be interrogated. Thankfully, libgit2
provides a thread safe config snapshot object to be used in
such scenarios.
Also updates the existing GitRepoRemote tests accordingly.
Diffstat (limited to 'src/other_tools/git_operations/git_repo_remote.hpp')
-rw-r--r-- | src/other_tools/git_operations/git_repo_remote.hpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/other_tools/git_operations/git_repo_remote.hpp b/src/other_tools/git_operations/git_repo_remote.hpp index 334f7fca..8b0021b8 100644 --- a/src/other_tools/git_operations/git_repo_remote.hpp +++ b/src/other_tools/git_operations/git_repo_remote.hpp @@ -50,9 +50,12 @@ class GitRepoRemote : public GitRepo { /// \brief Retrieve commit hash from remote branch given its name. /// Only possible with real repository and thus non-thread-safe. + /// If non-null, use given config snapshot to interact with config entries; + /// otherwise, use a snapshot from the current repo and share pointer to it. /// Returns the retrieved commit hash, or nullopt if failure. /// It guarantees the logger is called exactly once with fatal if failure. [[nodiscard]] auto GetCommitFromRemote( + std::shared_ptr<git_config> cfg, std::string const& repo_url, std::string const& branch, anon_logger_ptr const& logger) noexcept -> std::optional<std::string>; @@ -60,9 +63,12 @@ class GitRepoRemote : public GitRepo { /// \brief Fetch from given remote. It can either fetch a given named /// branch, or it can fetch with base refspecs. /// Only possible with real repository and thus non-thread-safe. - /// Returns a success flag. - /// It guarantees the logger is called exactly once with fatal if failure. - [[nodiscard]] auto FetchFromRemote(std::string const& repo_url, + /// If non-null, use given config snapshot to interact with config entries; + /// otherwise, use a snapshot from the current repo and share pointer to it. + /// Returns a success flag. It guarantees the logger is called + /// exactly once with fatal if failure. + [[nodiscard]] auto FetchFromRemote(std::shared_ptr<git_config> cfg, + std::string const& repo_url, std::optional<std::string> const& branch, anon_logger_ptr const& logger) noexcept -> bool; |