From a7cc305a3a6e2886a4f7ec7b8fd9943ff45f286d Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 20 Feb 2024 12:00:57 +0100 Subject: git repo fetch: support "inherit env" When fetching git repositories, just-mr routinely shells out to git. In this case, allow the user to specify via "inherit env", which environment variables from the host environment should be made available in this action. Typical variables to inherit are ones providing credentials, like SSH_AUTH_SOCK. As the repository description specifies the commit that will be taken, and hence the resulting tree, correctness is not affected by the environement leaking in here. --- src/other_tools/git_operations/git_repo_remote.hpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 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 ce818de6..614e7822 100644 --- a/src/other_tools/git_operations/git_repo_remote.hpp +++ b/src/other_tools/git_operations/git_repo_remote.hpp @@ -93,6 +93,7 @@ class GitRepoRemote : public GitRepo { std::filesystem::path const& tmp_dir, std::string const& repo_url, std::string const& branch, + std::vector const& inherit_env, std::string const& git_bin, std::vector const& launcher, anon_logger_ptr const& logger) const noexcept @@ -108,13 +109,14 @@ class GitRepoRemote : public GitRepo { /// 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::string const& git_bin, - std::vector const& launcher, - anon_logger_ptr const& logger) noexcept - -> bool; + [[nodiscard]] auto FetchViaTmpRepo( + std::filesystem::path const& tmp_dir, + std::string const& repo_url, + std::optional const& branch, + std::vector const& inherit_env, + std::string const& git_bin, + std::vector const& launcher, + anon_logger_ptr const& logger) noexcept -> bool; private: /// \brief Open "fake" repository wrapper for existing CAS. -- cgit v1.2.3