summaryrefslogtreecommitdiff
path: root/src/buildtool/storage/fs_utils.cpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-11-03 11:22:46 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-11-14 13:35:01 +0100
commitbcd000bed5f98b906ea4761ebe7422bca477672b (patch)
treeadfcf677b9f6a388c73975e9402c3d11a4cfa6bd /src/buildtool/storage/fs_utils.cpp
parent6377b2e150857ccf52269a0251dfcd201f9b296f (diff)
downloadjustbuild-bcd000bed5f98b906ea4761ebe7422bca477672b.tar.gz
fs_utils: Only accept strings as 'checkouts' map values
While we don't want to fail if the 'checkouts' map values are not strings, we shouldn't just accept non-string values either, instead we should warn the user and continue without them.
Diffstat (limited to 'src/buildtool/storage/fs_utils.cpp')
-rw-r--r--src/buildtool/storage/fs_utils.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/buildtool/storage/fs_utils.cpp b/src/buildtool/storage/fs_utils.cpp
index f2241fc9..f6055579 100644
--- a/src/buildtool/storage/fs_utils.cpp
+++ b/src/buildtool/storage/fs_utils.cpp
@@ -24,9 +24,16 @@ namespace StorageUtils {
auto GetGitRoot(LocalPathsPtr const& just_mr_paths,
std::string const& repo_url) noexcept -> std::filesystem::path {
if (just_mr_paths->git_checkout_locations.contains(repo_url)) {
- return std::filesystem::absolute(ToNormalPath(std::filesystem::path{
- just_mr_paths->git_checkout_locations[repo_url]
- .get<std::string>()}));
+ if (just_mr_paths->git_checkout_locations[repo_url].is_string()) {
+ return std::filesystem::absolute(ToNormalPath(std::filesystem::path{
+ just_mr_paths->git_checkout_locations[repo_url]
+ .get<std::string>()}));
+ }
+ Logger::Log(
+ LogLevel::Warning,
+ "Retrieving Git checkout location: key {} has non-string value {}",
+ nlohmann::json(repo_url).dump(),
+ just_mr_paths->git_checkout_locations[repo_url].dump());
}
auto repo_url_as_path = std::filesystem::absolute(
ToNormalPath(std::filesystem::path(repo_url)));