oid: provide private type_is_valid functionality

As users begin to specify the object ID types, provide an internal
mechanism to determine whether the type is valid / supported or not.
This commit is contained in:
Edward Thomson
2024-12-16 16:47:47 +00:00
parent 3251d1bb62
commit 009677e611

View File

@@ -66,6 +66,15 @@ GIT_INLINE(size_t) git_oid_hexsize(git_oid_t type)
return 0;
}
GIT_INLINE(bool) git_oid_type_is_valid(git_oid_t type)
{
return (type == GIT_OID_SHA1
#ifdef GIT_EXPERIMENTAL_SHA256
|| type == GIT_OID_SHA256
#endif
);
}
GIT_INLINE(const char *) git_oid_type_name(git_oid_t type)
{
switch (type) {