From 6e9151cfbdd816ce59f6340a0ca5800efabb894f Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Thu, 19 Jan 2023 10:23:18 +0100 Subject: GitRepo: Change FetchFromRemote to fetch based on branch name This also removes the need to call the GET_BRANCH_REFNAME critical operation. --- src/buildtool/file_system/git_repo.hpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 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 fbb07aec..3fda0516 100644 --- a/src/buildtool/file_system/git_repo.hpp +++ b/src/buildtool/file_system/git_repo.hpp @@ -155,14 +155,13 @@ class GitRepo { std::string const& branch_refname_local, anon_logger_ptr const& logger) noexcept -> std::optional; - /// \brief Fetch from given remote using refspec (usually for a branch). + /// \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. - /// If the refspec string in empty, performs a fetch of all branches with - /// default refspecs. /// Returns a success flag. /// It guarantees the logger is called exactly once with fatal if failure. [[nodiscard]] auto FetchFromRemote(std::string const& repo_url, - std::string const& refspec, + std::optional const& branch, anon_logger_ptr const& logger) noexcept -> bool; @@ -225,13 +224,13 @@ class GitRepo { /// custom backend to redirect the fetched objects into the desired odb. /// Caller needs to make sure the temporary directory exists and that the /// given path is thread- and process-safe! - /// Uses either a given branch refspec, or fetches all (if refspec empty). + /// Uses either a given branch, or fetches using base refspecs. /// Returns a success flag. /// It guarantees the logger is called exactly once with fatal if failure. [[nodiscard]] auto FetchViaTmpRepo( std::filesystem::path const& tmp_repo_path, std::string const& repo_url, - std::string const& refspec, + std::optional const& branch, anon_logger_ptr const& logger) noexcept -> bool; /// \brief Try to retrieve the root of the repository containing the -- cgit v1.2.3