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/just_mr/main.cpp | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'src/other_tools/just_mr/main.cpp') diff --git a/src/other_tools/just_mr/main.cpp b/src/other_tools/just_mr/main.cpp index 9f2a47ce..290d6bcf 100644 --- a/src/other_tools/just_mr/main.cpp +++ b/src/other_tools/just_mr/main.cpp @@ -379,6 +379,14 @@ void SetupLogging(MultiRepoLogArguments const& clargs) { clargs->common.just_path = just->first; } } + // read git binary path; overwritten if user provided it already + if (not clargs->common.git_path) { + auto git = ReadLocation(rc_config["git"], + clargs->common.just_mr_paths->workspace_root); + if (git) { + clargs->common.git_path = git->first; + } + } // read additional just args; user can append, but does not overwrite auto just_args = rc_config["just args"]; if (just_args.IsNotNull()) { @@ -1007,9 +1015,11 @@ void DefaultReachableRepositories( // Initialize resulting config to be updated auto mr_config = config->ToJson(); // Create async map - auto git_update_map = CreateGitUpdateMap(git_repo->GetGitCAS(), - *arguments.common.local_launcher, - arguments.common.jobs); + auto git_update_map = + CreateGitUpdateMap(git_repo->GetGitCAS(), + arguments.common.git_path->string(), + *arguments.common.local_launcher, + arguments.common.jobs); // set up progress observer JustMRProgress::Instance().SetTotal(repos_to_update.size()); @@ -1118,13 +1128,16 @@ void DefaultReachableRepositories( arguments.common.jobs); auto import_to_git_map = CreateImportToGitMap(&critical_git_op_map, + arguments.common.git_path->string(), *arguments.common.local_launcher, arguments.common.jobs); - auto commit_git_map = CreateCommitGitMap(&critical_git_op_map, - arguments.common.just_mr_paths, - *arguments.common.local_launcher, - arguments.common.jobs); + auto commit_git_map = + CreateCommitGitMap(&critical_git_op_map, + arguments.common.just_mr_paths, + arguments.common.git_path->string(), + *arguments.common.local_launcher, + arguments.common.jobs); auto content_git_map = CreateContentGitMap(&content_cas_map, &import_to_git_map, &critical_git_op_map, @@ -1137,9 +1150,11 @@ void DefaultReachableRepositories( &import_to_git_map, &critical_git_op_map, arguments.common.jobs); - auto tree_id_git_map = CreateTreeIdGitMap(&critical_git_op_map, - *arguments.common.local_launcher, - arguments.common.jobs); + auto tree_id_git_map = + CreateTreeIdGitMap(&critical_git_op_map, + arguments.common.git_path->string(), + *arguments.common.local_launcher, + arguments.common.jobs); auto repos_to_setup_map = CreateReposToSetupMap(config, main, interactive, @@ -1361,6 +1376,9 @@ auto main(int argc, char* argv[]) -> int { if (not arguments.common.just_path) { arguments.common.just_path = kDefaultJustPath; } + if (not arguments.common.git_path) { + arguments.common.git_path = kDefaultGitPath; + } bool forward_build_root = true; if (not arguments.common.just_mr_paths->root) { forward_build_root = false; -- cgit v1.2.3