From 7571f74dbc53e9b4fe3b9000662ca686960db78e Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Mon, 23 Sep 2024 12:09:44 +0200 Subject: StorageUtils: Add generation-aware rehashing ID file map Such a file could be used to store mappings of digests from CAS or Git cache to digests of different hash type that represent same content. --- src/buildtool/crypto/hash_info.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'src/buildtool/crypto/hash_info.cpp') diff --git a/src/buildtool/crypto/hash_info.cpp b/src/buildtool/crypto/hash_info.cpp index 4fb87161..e185d214 100644 --- a/src/buildtool/crypto/hash_info.cpp +++ b/src/buildtool/crypto/hash_info.cpp @@ -21,16 +21,6 @@ #include "src/utils/cpp/hex_string.hpp" namespace { -[[nodiscard]] inline auto GetHashTypeName(HashFunction::Type type) noexcept - -> std::string { - switch (type) { - case HashFunction::Type::GitSHA1: - return "GitSHA1"; - case HashFunction::Type::PlainSHA256: - return "PlainSHA256"; - } - Ensures(false); -} inline constexpr auto kSHA1EmptyGitBlobHash = "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"; @@ -91,7 +81,7 @@ auto HashInfo::ValidateInput(HashFunction::Type type, "HashInfo: hash {} is expected to be {}.\nTrees are " "not allowed in this mode.", hash, - GetHashTypeName(type)); + ToString(type)); } if (auto const exp_size = HashFunction{type}.MakeHasher().GetHashLength(); @@ -100,7 +90,7 @@ auto HashInfo::ValidateInput(HashFunction::Type type, "HashInfo: hash {} is expected to be {}.\n It must have a length " "of {}, but its length is {}.", hash, - GetHashTypeName(type), + ToString(type), exp_size, hash.size()); } -- cgit v1.2.3