summaryrefslogtreecommitdiff
path: root/src/other_tools/just_mr/main.cpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-03-22 14:23:24 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-03-23 09:50:43 +0100
commitd6eb885a3f205e00a3be9f2ae2e8f510cae15d8a (patch)
treedabb8e10973ae1d5f21f4c01bda72b3d1b68402d /src/other_tools/just_mr/main.cpp
parente0c38d7083e6c972a432bfff3a9863f251f2170c (diff)
downloadjustbuild-d6eb885a3f205e00a3be9f2ae2e8f510cae15d8a.tar.gz
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.
Diffstat (limited to 'src/other_tools/just_mr/main.cpp')
-rw-r--r--src/other_tools/just_mr/main.cpp38
1 files changed, 28 insertions, 10 deletions
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;