From 01ffd4d9a5f824a74b0e86750e9145fb623ccbcd Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Wed, 15 Nov 2023 17:45:12 +0100 Subject: git tree repository: Creating absent roots should not run the command Also extended absent-roots test with this scenario. --- src/other_tools/root_maps/tree_id_git_map.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/other_tools/root_maps/tree_id_git_map.cpp b/src/other_tools/root_maps/tree_id_git_map.cpp index ce2fe5e5..752f224d 100644 --- a/src/other_tools/root_maps/tree_id_git_map.cpp +++ b/src/other_tools/root_maps/tree_id_git_map.cpp @@ -96,7 +96,16 @@ auto CreateTreeIdGitMap( auto logger, auto /*unused*/, auto const& key) { - // first, check whether tree exists already in CAS + // if root is absent, no work needs to be done + if (key.absent) { + auto root = nlohmann::json::array( + {key.ignore_special ? FileRoot::kGitTreeIgnoreSpecialMarker + : FileRoot::kGitTreeMarker, + key.hash}); + (*setter)(std::pair(std::move(root), false)); + return; + } + // check whether tree exists already in CAS // ensure Git cache // define Git operation to be done GitOpKey op_key = {.params = -- cgit v1.2.3