From 2ebf355989eb92ac9967eceee0af14d39477afe0 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Fri, 23 Feb 2024 18:51:51 +0100 Subject: 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. --- src/other_tools/root_maps/commit_git_map.cpp | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 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 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, -- cgit v1.2.3