From d6eb885a3f205e00a3be9f2ae2e8f510cae15d8a Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Wed, 22 Mar 2023 14:23:24 +0100 Subject: just-mr: Add git binary option In the rare cases that we need to shell out to git, let the user configure what binary to use. Option resolves in the same way as the just executable, including allowing it to be set via just-mrrc. Updates all cases of shelling out to git (fetch and commit update). Update just-mr and just-mrrc docs accordingly. --- src/other_tools/root_maps/commit_git_map.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'src/other_tools/root_maps/commit_git_map.cpp') diff --git a/src/other_tools/root_maps/commit_git_map.cpp b/src/other_tools/root_maps/commit_git_map.cpp index 3500245b..48cf4d8f 100644 --- a/src/other_tools/root_maps/commit_git_map.cpp +++ b/src/other_tools/root_maps/commit_git_map.cpp @@ -36,6 +36,7 @@ void EnsureCommit(GitRepoInfo const& repo_info, std::filesystem::path const& repo_root, GitCASPtr const& git_cas, gsl::not_null const& critical_git_op_map, + std::string const& git_bin, std::vector const& launcher, gsl::not_null const& ts, CommitGitMap::SetterPtr const& ws_setter, @@ -77,6 +78,7 @@ void EnsureCommit(GitRepoInfo const& repo_info, if (not git_repo->FetchViaTmpRepo(tmp_dir->GetPath(), repo_info.repo_url, repo_info.branch, + git_bin, launcher, wrapped_logger)) { return; @@ -186,14 +188,17 @@ void EnsureCommit(GitRepoInfo const& repo_info, auto CreateCommitGitMap( gsl::not_null const& critical_git_op_map, JustMR::PathsPtr const& just_mr_paths, + std::string const& git_bin, std::vector const& launcher, std::size_t jobs) -> CommitGitMap { - auto commit_to_git = [critical_git_op_map, just_mr_paths, launcher]( - auto ts, - auto setter, - auto logger, - auto /* unused */, - auto const& key) { + auto commit_to_git = [critical_git_op_map, + just_mr_paths, + git_bin, + launcher](auto ts, + auto setter, + auto logger, + auto /* unused */, + auto const& key) { // get root for repo (making sure that if repo is a path, it is // absolute) std::string fetch_repo = key.repo_url; @@ -217,8 +222,14 @@ auto CreateCommitGitMap( critical_git_op_map->ConsumeAfterKeysReady( ts, {std::move(op_key)}, - [key, repo_root, critical_git_op_map, launcher, ts, setter, logger]( - auto const& values) { + [key, + repo_root, + critical_git_op_map, + git_bin, + launcher, + ts, + setter, + logger](auto const& values) { GitOpValue op_result = *values[0]; // check flag if (not op_result.result) { @@ -240,6 +251,7 @@ auto CreateCommitGitMap( repo_root, op_result.git_cas, critical_git_op_map, + git_bin, launcher, ts, setter, -- cgit v1.2.3