diff options
Diffstat (limited to 'src/buildtool/common/protocol_traits.hpp')
-rw-r--r-- | src/buildtool/common/protocol_traits.hpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/buildtool/common/protocol_traits.hpp b/src/buildtool/common/protocol_traits.hpp index 49850233..f1a51cbe 100644 --- a/src/buildtool/common/protocol_traits.hpp +++ b/src/buildtool/common/protocol_traits.hpp @@ -15,6 +15,8 @@ #ifndef INCLUDED_SRC_BUILDTOOL_COMMON_PROTOCOL_TRAITS_HPP #define INCLUDED_SRC_BUILDTOOL_COMMON_PROTOCOL_TRAITS_HPP +#include "src/buildtool/crypto/hash_function.hpp" + class ProtocolTraits final { public: [[nodiscard]] static auto Instance() noexcept -> ProtocolTraits& { @@ -26,6 +28,16 @@ class ProtocolTraits final { } void SetCompatible(bool value = true) noexcept { compatible_ = value; } + inline static constexpr auto IsNative(HashFunction::Type hash_type) noexcept + -> bool { + return hash_type == HashFunction::Type::GitSHA1; + } + + inline static constexpr auto IsTreeAllowed( + HashFunction::Type hash_type) noexcept -> bool { + return IsNative(hash_type); + } + private: bool compatible_ = false; }; |