summaryrefslogtreecommitdiff
path: root/src/buildtool/crypto/hash_info.cpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-09-23 12:09:44 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-10-25 13:00:43 +0200
commit7571f74dbc53e9b4fe3b9000662ca686960db78e (patch)
treeba1adfd9bd5a2024de2c0ddb0e8c9e76e947bdc2 /src/buildtool/crypto/hash_info.cpp
parentbfefe45f8731e10a92f739d630a3c027fc72bc5b (diff)
downloadjustbuild-7571f74dbc53e9b4fe3b9000662ca686960db78e.tar.gz
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.
Diffstat (limited to 'src/buildtool/crypto/hash_info.cpp')
-rw-r--r--src/buildtool/crypto/hash_info.cpp14
1 files changed, 2 insertions, 12 deletions
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());
}