From 2b316cf9bccc3608b439ddc69039377686350784 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Thu, 19 Jan 2023 11:13:33 +0100 Subject: GitRepo: Remove refspec argument in retrieving commit from remote... ...and use instead the branch name. A valid direct refspec (as those retrieved by a remote_ls call) will always end in the branch name, so checking the last path component ('/'-delimited substring) of a retrieved refspec is enough. --- src/buildtool/file_system/git_repo.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/buildtool/file_system/git_repo.hpp') diff --git a/src/buildtool/file_system/git_repo.hpp b/src/buildtool/file_system/git_repo.hpp index 3fda0516..3e3bf178 100644 --- a/src/buildtool/file_system/git_repo.hpp +++ b/src/buildtool/file_system/git_repo.hpp @@ -146,13 +146,13 @@ class GitRepo { std::string const& branch, anon_logger_ptr const& logger) noexcept -> std::optional; - /// \brief Retrieve commit hash from remote branch given its refname. + /// \brief Retrieve commit hash from remote branch given its name. /// Only possible with real repository and thus non-thread-safe. /// 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::string const& repo_url, - std::string const& branch_refname_local, + std::string const& branch, anon_logger_ptr const& logger) noexcept -> std::optional; /// \brief Fetch from given remote. It can either fetch a given named @@ -206,7 +206,7 @@ class GitRepo { /// \brief Get commit from remote via a temporary repository. /// Calling it from a fake repository allows thread-safe use. /// Creates a temporary real repository at the given location and uses it to - /// retrieve from the remote the commit of a branch given its refname. + /// retrieve from the remote the commit of a branch given its name. /// Caller needs to make sure the temporary directory exists and that the /// given path is thread- and process-safe! /// Returns the commit hash, as a string, or nullopt if failure. @@ -214,7 +214,7 @@ class GitRepo { [[nodiscard]] auto UpdateCommitViaTmpRepo( std::filesystem::path const& tmp_repo_path, std::string const& repo_url, - std::string const& branch_refname, + std::string const& branch, anon_logger_ptr const& logger) const noexcept -> std::optional; -- cgit v1.2.3