summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-11-15 17:45:12 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-11-15 17:52:41 +0100
commit01ffd4d9a5f824a74b0e86750e9145fb623ccbcd (patch)
treea3ae5656966a96f2e87fbf8efab9c40ececae36a /src
parent808352e5473f90b4042370e037788d3793f4b8c3 (diff)
downloadjustbuild-01ffd4d9a5f824a74b0e86750e9145fb623ccbcd.tar.gz
git tree repository: Creating absent roots should not run the command
Also extended absent-roots test with this scenario.
Diffstat (limited to 'src')
-rw-r--r--src/other_tools/root_maps/tree_id_git_map.cpp11
1 files changed, 10 insertions, 1 deletions
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 =