From 2ebf355989eb92ac9967eceee0af14d39477afe0 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Fri, 23 Feb 2024 18:51:51 +0100 Subject: just-mr: Fix shell out execution ... by avoiding reusing temp dirs for execute. While we are at it, also refactor LocalFetchViaTmpRepo() to create its own empty temp dirs, that cannot be reused by the caller. --- src/other_tools/git_operations/git_repo_remote.hpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/other_tools/git_operations/git_repo_remote.hpp') diff --git a/src/other_tools/git_operations/git_repo_remote.hpp b/src/other_tools/git_operations/git_repo_remote.hpp index 614e7822..c59fb48e 100644 --- a/src/other_tools/git_operations/git_repo_remote.hpp +++ b/src/other_tools/git_operations/git_repo_remote.hpp @@ -82,15 +82,11 @@ class GitRepoRemote : public GitRepo { /// \brief Get commit from given branch on the remote. If URL is SSH, shells /// out to system git to perform an ls-remote call, ensuring correct /// handling of the remote connection settings (in particular proxy and - /// SSH). A temporary directory is needed to pipe the stdout and stderr to. - /// If URL is non-SSH, uses tmp dir to connect to remote and retrieve the - /// commit of a branch asynchronously using libgit2. - /// Caller needs to make sure the temporary directory exists and that the - /// given path is thread- and process-safe! + /// SSH). For non-SSH URLs, the branch commit is retrieved asynchronously + /// using libgit2. /// Returns the commit hash, as a string, or nullopt if failure. /// It guarantees the logger is called exactly once with fatal if failure. [[nodiscard]] auto UpdateCommitViaTmpRepo( - std::filesystem::path const& tmp_dir, std::string const& repo_url, std::string const& branch, std::vector const& inherit_env, @@ -101,16 +97,12 @@ class GitRepoRemote : public GitRepo { /// \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! + /// there can be some redundancy in the fetched packs. + /// For non-SSH URLs an asynchronous fetch is performed using libgit2. /// 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_dir, std::string const& repo_url, std::optional const& branch, std::vector const& inherit_env, -- cgit v1.2.3