diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-03-21 14:02:44 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-03-22 17:35:18 +0100 |
commit | 17143ed02545efab55c175db66a9e31db4cce0f0 (patch) | |
tree | 953bb233a3b0fcd7b3bd3bec04ef196f6739ab82 /src/other_tools/git_operations/git_repo_remote.hpp | |
parent | 854745ad36f54559360a7dfc937c382cd0faf057 (diff) | |
download | justbuild-17143ed02545efab55c175db66a9e31db4cce0f0.tar.gz |
just-mr: Shell out to system Git for fetches over SSH...
...due to limited SSH support in libgit2. In order to allow the
fetches to still be parallel, we execute:
git fetch --no-auto-gc --no-write-fetch-head <repo> [<branch>]
This only fetches the packs without updating any refs, at the slight
cost of sometimes fetching some redundant information, which for our
purposes is practically a non-issue.
(If really needed, a 'git gc' call can be done eventually to try to
compact the fetched packs, although a save in disk space is not
actually guaranteed.)
Diffstat (limited to 'src/other_tools/git_operations/git_repo_remote.hpp')
-rw-r--r-- | src/other_tools/git_operations/git_repo_remote.hpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/other_tools/git_operations/git_repo_remote.hpp b/src/other_tools/git_operations/git_repo_remote.hpp index 8b0021b8..64c827c4 100644 --- a/src/other_tools/git_operations/git_repo_remote.hpp +++ b/src/other_tools/git_operations/git_repo_remote.hpp @@ -88,20 +88,22 @@ class GitRepoRemote : public GitRepo { anon_logger_ptr const& logger) const noexcept -> std::optional<std::string>; - /// \brief Fetch from a 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 a - /// custom backend to redirect the fetched objects into the desired odb. + /// \brief Fetch from a remote. If URL is SSH, shells out to system git to + /// retrieve packs in a safe manner, with the only side-effect being that + /// there can be some redundancy in the fetched packs. The tmp dir is used + /// to pipe the stdout and stderr to. + /// If URL is non-SSH, uses tmp dir to fetch asynchronously using libgit2. /// Caller needs to make sure the temporary directory exists and that the /// given path is thread- and process-safe! - /// Uses either a given branch, or fetches using base refspecs. + /// Uses either a given branch, or fetches all (with 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::optional<std::string> const& branch, - anon_logger_ptr const& logger) noexcept -> bool; + [[nodiscard]] auto FetchViaTmpRepo(std::filesystem::path const& tmp_dir, + std::string const& repo_url, + std::optional<std::string> const& branch, + std::vector<std::string> const& launcher, + anon_logger_ptr const& logger) noexcept + -> bool; /// \brief Get a snapshot of the repository configuration. /// Returns nullptr on errors. |