summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Sartori <alberto.sartori@huawei.com>2022-06-14 17:59:38 +0200
committerAlberto Sartori <alberto.sartori@huawei.com>2022-06-14 18:14:45 +0200
commit37f7e717f3bc8792eb6c7389cb88aec50e414293 (patch)
treeed67cbcd3c0d6327f4e99f3c6dee9c9733bcf165
parenta9e46c62e6a62cf2d7983accfe6f9fa432c720dc (diff)
downloadjustbuild-37f7e717f3bc8792eb6c7389cb88aec50e414293.tar.gz
fix handling of workspace root for the main repository
commit fd58a5eb429d4a9db51f73c06137f1a4ebe41c08 introduced a bug. If the main workspace root is a git repo, it will be overwritten by a std::optional<std::filesystem::path> storing std::nullopt. This patch fixes this wrong behaviour.
-rw-r--r--src/buildtool/main/main.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index d522c345..4f074eb4 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -587,7 +587,7 @@ auto DetermineRoots(CommonArguments const& cargs,
if (it_ws != desc.end()) {
auto [root, path] = ParseRoot(repo, "workspace_root", *it_ws);
ws_root = std::move(root);
- if (is_main_repo) {
+ if (is_main_repo and path.has_value()) {
main_ws_root = std::move(path);
}
}
@@ -600,7 +600,9 @@ auto DetermineRoots(CommonArguments const& cargs,
else if (not ws_root) {
main_ws_root = DetermineWorkspaceRootByLookingForMarkers();
}
- ws_root = FileRoot{*main_ws_root};
+ if (main_ws_root.has_value()) {
+ ws_root = FileRoot{*main_ws_root};
+ }
}
if (not ws_root) {
Logger::Log(LogLevel::Error,
@@ -623,6 +625,7 @@ auto DetermineRoots(CommonArguments const& cargs,
}
};
+ info.target_root = info.workspace_root;
parse_keyword_root(&info.target_root, "target_root", aargs.target_root);
info.rule_root = info.target_root;