From a2ffc06b03cdaf013ddf8825d60b8ee4a9dca431 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Wed, 6 Mar 2024 16:48:04 +0100 Subject: just-mr: Normalize paths of Git file URLs ... and ensure that paths starting with .// remain relative. --- src/other_tools/root_maps/commit_git_map.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/other_tools/root_maps/commit_git_map.cpp') 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; -- cgit v1.2.3