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