summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/git_repo.hpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-01-19 10:23:18 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-01-24 15:47:31 +0100
commit6e9151cfbdd816ce59f6340a0ca5800efabb894f (patch)
treebb4352e6a3c52b55b7194bbd87c39a5ef15ee618 /src/buildtool/file_system/git_repo.hpp
parent24d1fae0733b6f89c55797d3a93aba220de2ae44 (diff)
downloadjustbuild-6e9151cfbdd816ce59f6340a0ca5800efabb894f.tar.gz
GitRepo: Change FetchFromRemote to fetch based on branch name
This also removes the need to call the GET_BRANCH_REFNAME critical operation.
Diffstat (limited to 'src/buildtool/file_system/git_repo.hpp')
-rw-r--r--src/buildtool/file_system/git_repo.hpp11
1 files changed, 5 insertions, 6 deletions
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<std::string>;
- /// \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<std::string> 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<std::string> const& branch,
anon_logger_ptr const& logger) noexcept -> bool;
/// \brief Try to retrieve the root of the repository containing the