object: introduce type_is_valid

There's no such thing as a "loose object type" or a "packed object
type". There are only object types. Introduce `type_is_valid` and
deprecate `typeisloose`.
This commit is contained in:
Edward Thomson
2025-01-03 09:21:16 +00:00
parent 842fcef3eb
commit 2d5942571c
6 changed files with 43 additions and 34 deletions

View File

@@ -665,6 +665,16 @@ GIT_EXTERN(int) git_index_add_frombuffer(
*/
GIT_EXTERN(size_t) git_object__size(git_object_t type);
/**
* Determine if the given git_object_t is a valid object type.
*
* @deprecated use `git_object_type_is_valid`
*
* @param type object type to test.
* @return 1 if the type represents a valid object type, 0 otherwise
*/
GIT_EXTERN(int) git_object_typeisloose(git_object_t type);
/**@}*/
/** @name Deprecated Remote Functions

View File

@@ -180,13 +180,12 @@ GIT_EXTERN(const char *) git_object_type2string(git_object_t type);
GIT_EXTERN(git_object_t) git_object_string2type(const char *str);
/**
* Determine if the given git_object_t is a valid loose object type.
* Determine if the given git_object_t is a valid object type.
*
* @param type object type to test.
* @return true if the type represents a valid loose object type,
* false otherwise.
* @return 1 if the type represents a valid loose object type, 0 otherwise
*/
GIT_EXTERN(int) git_object_typeisloose(git_object_t type);
GIT_EXTERN(int) git_object_type_is_valid(git_object_t type);
/**
* Recursively peel an object until an object of the specified type is met.