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 11:13:33 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-01-24 15:47:31 +0100
commit2b316cf9bccc3608b439ddc69039377686350784 (patch)
tree2e00926ca30ef55e3ae66c381ea5a0e650173de7 /src/buildtool/file_system/git_repo.hpp
parent51130a4ef9bfb4139ffb748d1e0e4f491a442bfd (diff)
downloadjustbuild-2b316cf9bccc3608b439ddc69039377686350784.tar.gz
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.
Diffstat (limited to 'src/buildtool/file_system/git_repo.hpp')
-rw-r--r--src/buildtool/file_system/git_repo.hpp8
1 files changed, 4 insertions, 4 deletions
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<std::string>;
- /// \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<std::string>;
/// \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<std::string>;