From c9beba5763c98ab0c13e46631aef1e9da1022f0e Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Fri, 23 Dec 2022 17:21:03 +0100 Subject: Just-MR: Fix wrong commit_git_map key The subdir is required alongside the commit hash for a valid map key when importing a Git repository into our Git cache. --- src/other_tools/root_maps/commit_git_map.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/other_tools/root_maps/commit_git_map.hpp') diff --git a/src/other_tools/root_maps/commit_git_map.hpp b/src/other_tools/root_maps/commit_git_map.hpp index e032cf65..eb7c26a9 100644 --- a/src/other_tools/root_maps/commit_git_map.hpp +++ b/src/other_tools/root_maps/commit_git_map.hpp @@ -27,10 +27,10 @@ struct GitRepoInfo { std::string hash{}; /* key */ std::string repo_url{}; std::string branch{}; - std::string subdir{}; + std::string subdir{}; /* key */ [[nodiscard]] auto operator==(const GitRepoInfo& other) const -> bool { - return hash == other.hash; + return hash == other.hash and subdir == other.subdir; } }; @@ -39,7 +39,10 @@ template <> struct hash { [[nodiscard]] auto operator()(const GitRepoInfo& ct) const noexcept -> std::size_t { - return std::hash{}(ct.hash); + size_t seed{}; + hash_combine(&seed, ct.hash); + hash_combine(&seed, ct.subdir); + return seed; } }; } // namespace std -- cgit v1.2.3