diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-05-25 17:11:19 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-05-31 15:21:02 +0200 |
commit | 6215a8c22c486c9a2dbb79cc6d202c5b6d542229 (patch) | |
tree | 8c5d7e1f5e3341e499ebcbbe914813f57d3c40c4 /src/other_tools/root_maps/distdir_git_map.cpp | |
parent | 17031e98529b62afad88c35c0d12491bf12b53ca (diff) | |
download | justbuild-6215a8c22c486c9a2dbb79cc6d202c5b6d542229.tar.gz |
distdir repos: Add option for ignore-special root
Diffstat (limited to 'src/other_tools/root_maps/distdir_git_map.cpp')
-rw-r--r-- | src/other_tools/root_maps/distdir_git_map.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/other_tools/root_maps/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp index 952eeb75..db0e8ee9 100644 --- a/src/other_tools/root_maps/distdir_git_map.cpp +++ b/src/other_tools/root_maps/distdir_git_map.cpp @@ -17,6 +17,7 @@ #include <algorithm> #include "src/buildtool/execution_api/common/execution_common.hpp" +#include "src/buildtool/file_system/file_root.hpp" #include "src/buildtool/file_system/file_storage.hpp" #include "src/buildtool/storage/config.hpp" #include "src/buildtool/storage/storage.hpp" @@ -88,8 +89,10 @@ auto CreateDistdirGitMap( critical_git_op_map->ConsumeAfterKeysReady( ts, {std::move(op_key)}, - [distdir_tree_id = *distdir_tree_id, setter, logger]( - auto const& values) { + [distdir_tree_id = *distdir_tree_id, + ignore_special = key.ignore_special, + setter, + logger](auto const& values) { GitOpValue op_result = *values[0]; // check flag if (not op_result.result) { @@ -99,12 +102,14 @@ auto CreateDistdirGitMap( } // subdir is ".", so no need to deal with the Git cache // set the workspace root - (*setter)( - std::pair(nlohmann::json::array( - {"git tree", - distdir_tree_id, - StorageConfig::GitRoot().string()}), - true)); + (*setter)(std::pair( + nlohmann::json::array( + {ignore_special + ? FileRoot::kGitTreeIgnoreSpecialMarker + : FileRoot::kGitTreeMarker, + distdir_tree_id, + StorageConfig::GitRoot().string()}), + true)); }, [logger, target_path = StorageConfig::GitRoot()]( auto const& msg, bool fatal) { @@ -125,6 +130,7 @@ auto CreateDistdirGitMap( content_id = key.content_id, content_list = key.content_list, origin = key.origin, + ignore_special = key.ignore_special, import_to_git_map, ts, setter, @@ -156,6 +162,7 @@ auto CreateDistdirGitMap( [tmp_dir, // keep tmp_dir alive distdir_tree_id_file, origin, + ignore_special, setter, logger](auto const& values) { // check for errors @@ -179,7 +186,9 @@ auto CreateDistdirGitMap( // set the workspace root (*setter)(std::pair( nlohmann::json::array( - {"git tree", + {ignore_special + ? FileRoot::kGitTreeIgnoreSpecialMarker + : FileRoot::kGitTreeMarker, distdir_tree_id, StorageConfig::GitRoot().string()}), false)); |