diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2024-02-23 18:51:51 +0100 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2024-03-08 14:16:45 +0100 |
commit | 2ebf355989eb92ac9967eceee0af14d39477afe0 (patch) | |
tree | db993f8df39eb05b625b2c4590f1e5696b2e7b04 /src/other_tools/root_maps/commit_git_map.cpp | |
parent | c512ae174920ada425e2b33d0fea24891d6305bd (diff) | |
download | justbuild-2ebf355989eb92ac9967eceee0af14d39477afe0.tar.gz |
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.
Diffstat (limited to 'src/other_tools/root_maps/commit_git_map.cpp')
-rw-r--r-- | src/other_tools/root_maps/commit_git_map.cpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/other_tools/root_maps/commit_git_map.cpp b/src/other_tools/root_maps/commit_git_map.cpp index d97f33be..a64ccc49 100644 --- a/src/other_tools/root_maps/commit_git_map.cpp +++ b/src/other_tools/root_maps/commit_git_map.cpp @@ -29,7 +29,6 @@ #include "src/other_tools/just_mr/progress_reporting/statistics.hpp" #include "src/other_tools/root_maps/root_utils.hpp" #include "src/other_tools/utils/curl_url_handle.hpp" -#include "src/utils/cpp/tmp_dir.hpp" namespace { @@ -224,13 +223,6 @@ void NetworkFetchAndSetPresentRoot( return; } - // default to fetching from network - auto tmp_dir = StorageUtils::CreateTypedTmpDir("fetch"); - if (not tmp_dir) { - (*logger)("Failed to create fetch tmp directory!", - /*fatal=*/true); - return; - } // store failed attempts for subsequent logging bool fetched{false}; std::string err_messages{}; @@ -251,8 +243,7 @@ void NetworkFetchAndSetPresentRoot( mirror, msg); }); - if (git_repo->FetchViaTmpRepo(tmp_dir->GetPath(), - mirror, + if (git_repo->FetchViaTmpRepo(mirror, repo_info.branch, repo_info.inherit_env, git_bin, @@ -284,8 +275,7 @@ void NetworkFetchAndSetPresentRoot( *preferred_url, msg); }); - if (git_repo->FetchViaTmpRepo(tmp_dir->GetPath(), - *preferred_url, + if (git_repo->FetchViaTmpRepo(*preferred_url, repo_info.branch, repo_info.inherit_env, git_bin, @@ -316,8 +306,7 @@ void NetworkFetchAndSetPresentRoot( fetch_repo, msg); }); - if (git_repo->FetchViaTmpRepo(tmp_dir->GetPath(), - fetch_repo, + if (git_repo->FetchViaTmpRepo(fetch_repo, repo_info.branch, repo_info.inherit_env, git_bin, @@ -352,7 +341,6 @@ void NetworkFetchAndSetPresentRoot( msg); }); if (git_repo->FetchViaTmpRepo( - tmp_dir->GetPath(), *preferred_mirror, repo_info.branch, repo_info.inherit_env, @@ -386,8 +374,7 @@ void NetworkFetchAndSetPresentRoot( mirror, msg); }); - if (git_repo->FetchViaTmpRepo(tmp_dir->GetPath(), - mirror, + if (git_repo->FetchViaTmpRepo(mirror, repo_info.branch, repo_info.inherit_env, git_bin, |