diff options
Diffstat (limited to 'src/other_tools/root_maps/distdir_git_map.cpp')
-rw-r--r-- | src/other_tools/root_maps/distdir_git_map.cpp | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/other_tools/root_maps/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp index a0971478..a132cf47 100644 --- a/src/other_tools/root_maps/distdir_git_map.cpp +++ b/src/other_tools/root_maps/distdir_git_map.cpp @@ -90,8 +90,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, + absent = key.absent, + setter, + logger](auto const& values) { GitOpValue op_result = *values[0]; // check flag if (not op_result.result) { @@ -101,12 +103,12 @@ auto CreateDistdirGitMap( } // subdir is ".", so no need to deal with the Git cache // set the workspace root - (*setter)( - std::pair(nlohmann::json::array( - {FileRoot::kGitTreeMarker, - distdir_tree_id, - StorageConfig::GitRoot().string()}), - true)); + auto root = nlohmann::json::array( + {FileRoot::kGitTreeMarker, distdir_tree_id}); + if (not absent) { + root.emplace_back(StorageConfig::GitRoot().string()); + } + (*setter)(std::pair(std::move(root), true)); }, [logger, target_path = StorageConfig::GitRoot()]( auto const& msg, bool fatal) { @@ -126,6 +128,7 @@ auto CreateDistdirGitMap( [distdir_tree_id_file, content_id = key.content_id, content_list = key.content_list, + absent = key.absent, import_to_git_map, ts, setter, @@ -156,6 +159,7 @@ auto CreateDistdirGitMap( {std::move(c_info)}, [tmp_dir, // keep tmp_dir alive distdir_tree_id_file, + absent, setter, logger](auto const& values) { // check for errors @@ -177,12 +181,13 @@ auto CreateDistdirGitMap( return; } // set the workspace root - (*setter)(std::pair( - nlohmann::json::array( - {FileRoot::kGitTreeMarker, - distdir_tree_id, - StorageConfig::GitRoot().string()}), - false)); + auto root = nlohmann::json::array( + {FileRoot::kGitTreeMarker, distdir_tree_id}); + if (not absent) { + root.emplace_back( + StorageConfig::GitRoot().string()); + } + (*setter)(std::pair(std::move(root), false)); }, [logger, target_path = tmp_dir->GetPath()]( auto const& msg, bool fatal) { |