diff options
Diffstat (limited to 'src/object.h')
-rw-r--r-- | src/object.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/object.h b/src/object.h index d187c55b7..dd227d16d 100644 --- a/src/object.h +++ b/src/object.h @@ -7,6 +7,10 @@ #ifndef INCLUDE_object_h__ #define INCLUDE_object_h__ +#include "repository.h" + +extern bool git_object__strict_input_validation; + /** Base git object for inheritance */ struct git_object { git_cached_obj cached; @@ -28,4 +32,23 @@ int git_oid__parse(git_oid *oid, const char **buffer_out, const char *buffer_end void git_oid__writebuf(git_buf *buf, const char *header, const git_oid *oid); +bool git_object__is_valid( + git_repository *repo, const git_oid *id, git_otype expected_type); + +GIT_INLINE(git_otype) git_object__type_from_filemode(git_filemode_t mode) +{ + switch (mode) { + case GIT_FILEMODE_TREE: + return GIT_OBJ_TREE; + case GIT_FILEMODE_COMMIT: + return GIT_OBJ_COMMIT; + case GIT_FILEMODE_BLOB: + case GIT_FILEMODE_BLOB_EXECUTABLE: + case GIT_FILEMODE_LINK: + return GIT_OBJ_BLOB; + default: + return GIT_OBJ_BAD; + } +} + #endif |