diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2024-03-06 16:48:04 +0100 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2024-03-08 14:18:43 +0100 |
commit | a2ffc06b03cdaf013ddf8825d60b8ee4a9dca431 (patch) | |
tree | 08d0985adb90640f8fdea52d8bb8365347adb99d /src/other_tools/root_maps/commit_git_map.cpp | |
parent | 197dffc50bed5bce87c142891eee616549670c84 (diff) | |
download | justbuild-a2ffc06b03cdaf013ddf8825d60b8ee4a9dca431.tar.gz |
just-mr: Normalize paths of Git file URLs
... and ensure that paths starting with .// remain relative.
Diffstat (limited to 'src/other_tools/root_maps/commit_git_map.cpp')
-rw-r--r-- | src/other_tools/root_maps/commit_git_map.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/other_tools/root_maps/commit_git_map.cpp b/src/other_tools/root_maps/commit_git_map.cpp index a64ccc49..e5910b9b 100644 --- a/src/other_tools/root_maps/commit_git_map.cpp +++ b/src/other_tools/root_maps/commit_git_map.cpp @@ -29,6 +29,7 @@ #include "src/other_tools/just_mr/progress_reporting/statistics.hpp" #include "src/other_tools/root_maps/root_utils.hpp" #include "src/other_tools/utils/curl_url_handle.hpp" +#include "src/utils/cpp/path.hpp" namespace { @@ -38,14 +39,11 @@ namespace { static auto const kRelPath = std::string{"./"}; static auto const kFileScheme = std::string{"file://"}; - if (url.starts_with(kAbsPath)) { - return url; - } - if (url.starts_with(kRelPath)) { - return url.substr(kRelPath.length()); + if (url.starts_with(kAbsPath) or url.starts_with(kRelPath)) { + return ToNormalPath(url).string(); } if (url.starts_with(kFileScheme)) { - return url.substr(kFileScheme.length()); + return ToNormalPath(url.substr(kFileScheme.length())).string(); } return std::nullopt; |