diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2022-12-23 17:21:03 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2022-12-23 18:33:09 +0100 |
commit | c9beba5763c98ab0c13e46631aef1e9da1022f0e (patch) | |
tree | dc4bc39f03c74a3d87dbe720a36bfddb30dd8a30 /src/other_tools/root_maps/commit_git_map.hpp | |
parent | 0374b80dd407d7b35654a01e3c7526b749d3464e (diff) | |
download | justbuild-c9beba5763c98ab0c13e46631aef1e9da1022f0e.tar.gz |
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.
Diffstat (limited to 'src/other_tools/root_maps/commit_git_map.hpp')
-rw-r--r-- | src/other_tools/root_maps/commit_git_map.hpp | 9 |
1 files changed, 6 insertions, 3 deletions
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<GitRepoInfo> { [[nodiscard]] auto operator()(const GitRepoInfo& ct) const noexcept -> std::size_t { - return std::hash<std::string>{}(ct.hash); + size_t seed{}; + hash_combine<std::string>(&seed, ct.hash); + hash_combine<std::string>(&seed, ct.subdir); + return seed; } }; } // namespace std |