diff options
Diffstat (limited to 'src/buildtool/file_system/git_cas.cpp')
-rw-r--r-- | src/buildtool/file_system/git_cas.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/buildtool/file_system/git_cas.cpp b/src/buildtool/file_system/git_cas.cpp index f134a894..7bddf6b3 100644 --- a/src/buildtool/file_system/git_cas.cpp +++ b/src/buildtool/file_system/git_cas.cpp @@ -21,6 +21,7 @@ #include "gsl/gsl" #include "src/buildtool/logging/logger.hpp" #include "src/utils/cpp/hex_string.hpp" +#include "src/utils/cpp/path.hpp" #ifndef BOOTSTRAP_BUILD_TOOL @@ -155,9 +156,21 @@ auto GitCAS::OpenODB(std::filesystem::path const& repo_path) noexcept -> bool { git_odb* odb_ptr{nullptr}; git_repository_odb(&odb_ptr, repo); odb_.reset(odb_ptr); // retain odb pointer - // set root - git_path_ = std::filesystem::weakly_canonical(std::filesystem::absolute( - std::filesystem::path(git_repository_path(repo)))); + // set root + std::filesystem::path git_path = + ToNormalPath(git_repository_path(repo)); + if (not git_path.is_absolute()) { + try { + git_path = std::filesystem::absolute(git_path); + } catch (std::exception const& e) { + Logger::Log(LogLevel::Error, + "Failed to obtain absolute path for {}: {}", + git_path.string(), + e.what()); + return false; + } + } + git_path_ = git_path; // release resources git_repository_free(repo); } |