summaryrefslogtreecommitdiff
path: root/src/other_tools/root_maps/content_git_map.cpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2023-04-03 16:38:54 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2023-04-04 15:18:45 +0200
commit95b3fcb09e94ac9f114509b205903b25a2bbd3ba (patch)
tree1ba56457c5ecdb8b6959213dc2458dbb6688b517 /src/other_tools/root_maps/content_git_map.cpp
parent65b29dfc610d9393337c20e30f5b96e35dffebd0 (diff)
downloadjustbuild-95b3fcb09e94ac9f114509b205903b25a2bbd3ba.tar.gz
Make git root part of the storage config
In this way, we have the whole layout of the local build root consolidated in one place. Moreover, in this way, the location of the git root is also available to the build tool itself and can, e.g., be used as fallback CAS.
Diffstat (limited to 'src/other_tools/root_maps/content_git_map.cpp')
-rw-r--r--src/other_tools/root_maps/content_git_map.cpp47
1 files changed, 23 insertions, 24 deletions
diff --git a/src/other_tools/root_maps/content_git_map.cpp b/src/other_tools/root_maps/content_git_map.cpp
index 80072fee..9af1c49c 100644
--- a/src/other_tools/root_maps/content_git_map.cpp
+++ b/src/other_tools/root_maps/content_git_map.cpp
@@ -15,6 +15,7 @@
#include "src/other_tools/root_maps/content_git_map.hpp"
#include "src/buildtool/file_system/file_storage.hpp"
+#include "src/buildtool/storage/config.hpp"
#include "src/buildtool/storage/storage.hpp"
#include "src/other_tools/just_mr/progress_reporting/progress.hpp"
#include "src/other_tools/just_mr/progress_reporting/statistics.hpp"
@@ -67,15 +68,14 @@ auto CreateContentGitMap(
}
// ensure Git cache
// define Git operation to be done
- GitOpKey op_key = {
- {
- JustMR::Utils::GetGitCacheRoot(), // target_path
- "", // git_hash
- "", // branch
- std::nullopt, // message
- true // init_bare
- },
- GitOpType::ENSURE_INIT};
+ GitOpKey op_key = {{
+ StorageConfig::GitRoot(), // target_path
+ "", // git_hash
+ "", // branch
+ std::nullopt, // message
+ true // init_bare
+ },
+ GitOpType::ENSURE_INIT};
critical_git_op_map->ConsumeAfterKeysReady(
ts,
{std::move(op_key)},
@@ -114,14 +114,14 @@ auto CreateContentGitMap(
return;
}
// set the workspace root
- (*setter)(std::pair(
- nlohmann::json::array(
- {"git tree",
- *subtree_hash,
- JustMR::Utils::GetGitCacheRoot().string()}),
- true));
+ (*setter)(
+ std::pair(nlohmann::json::array(
+ {"git tree",
+ *subtree_hash,
+ StorageConfig::GitRoot().string()}),
+ true));
},
- [logger, target_path = JustMR::Utils::GetGitCacheRoot()](
+ [logger, target_path = StorageConfig::GitRoot()](
auto const& msg, bool fatal) {
(*logger)(fmt::format("While running critical Git "
"op ENSURE_INIT for "
@@ -204,7 +204,7 @@ auto CreateContentGitMap(
}
// we look for subtree in Git cache
auto just_git_cas =
- GitCAS::Open(JustMR::Utils::GetGitCacheRoot());
+ GitCAS::Open(StorageConfig::GitRoot());
if (not just_git_cas) {
(*logger)(
"Could not open Git cache object database!",
@@ -239,13 +239,12 @@ auto CreateContentGitMap(
return;
}
// set the workspace root
- (*setter)(
- std::pair(nlohmann::json::array(
- {"git tree",
- *subtree_hash,
- JustMR::Utils::GetGitCacheRoot()
- .string()}),
- false));
+ (*setter)(std::pair(
+ nlohmann::json::array(
+ {"git tree",
+ *subtree_hash,
+ StorageConfig::GitRoot().string()}),
+ false));
},
[logger, target_path = tmp_dir->GetPath()](
auto const& msg, bool fatal) {