|
Packit |
ae9e2a |
/*
|
|
Packit |
ae9e2a |
* Copyright (C) the libgit2 contributors. All rights reserved.
|
|
Packit |
ae9e2a |
*
|
|
Packit |
ae9e2a |
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
|
Packit |
ae9e2a |
* a Linking Exception. For full terms see the included COPYING file.
|
|
Packit |
ae9e2a |
*/
|
|
Packit |
ae9e2a |
#ifndef INCLUDE_object_h__
|
|
Packit |
ae9e2a |
#define INCLUDE_object_h__
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
#include "repository.h"
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
extern bool git_object__strict_input_validation;
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
/** Base git object for inheritance */
|
|
Packit |
ae9e2a |
struct git_object {
|
|
Packit |
ae9e2a |
git_cached_obj cached;
|
|
Packit |
ae9e2a |
git_repository *repo;
|
|
Packit |
ae9e2a |
};
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
/* fully free the object; internal method, DO NOT EXPORT */
|
|
Packit |
ae9e2a |
void git_object__free(void *object);
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
int git_object__from_odb_object(
|
|
Packit |
ae9e2a |
git_object **object_out,
|
|
Packit |
ae9e2a |
git_repository *repo,
|
|
Packit |
ae9e2a |
git_odb_object *odb_obj,
|
|
Packit |
ae9e2a |
git_otype type);
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
int git_object__resolve_to_type(git_object **obj, git_otype type);
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
int git_oid__parse(git_oid *oid, const char **buffer_out, const char *buffer_end, const char *header);
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
void git_oid__writebuf(git_buf *buf, const char *header, const git_oid *oid);
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
bool git_object__is_valid(
|
|
Packit |
ae9e2a |
git_repository *repo, const git_oid *id, git_otype expected_type);
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
GIT_INLINE(git_otype) git_object__type_from_filemode(git_filemode_t mode)
|
|
Packit |
ae9e2a |
{
|
|
Packit |
ae9e2a |
switch (mode) {
|
|
Packit |
ae9e2a |
case GIT_FILEMODE_TREE:
|
|
Packit |
ae9e2a |
return GIT_OBJ_TREE;
|
|
Packit |
ae9e2a |
case GIT_FILEMODE_COMMIT:
|
|
Packit |
ae9e2a |
return GIT_OBJ_COMMIT;
|
|
Packit |
ae9e2a |
case GIT_FILEMODE_BLOB:
|
|
Packit |
ae9e2a |
case GIT_FILEMODE_BLOB_EXECUTABLE:
|
|
Packit |
ae9e2a |
case GIT_FILEMODE_LINK:
|
|
Packit |
ae9e2a |
return GIT_OBJ_BLOB;
|
|
Packit |
ae9e2a |
default:
|
|
Packit |
ae9e2a |
return GIT_OBJ_BAD;
|
|
Packit |
ae9e2a |
}
|
|
Packit |
ae9e2a |
}
|
|
Packit |
ae9e2a |
|
|
Packit |
ae9e2a |
#endif
|