]> git.proxmox.com Git - libgit2.git/blame - src/object_api.c
Merge pull request #3097 from libgit2/cmn/submodule-config-state
[libgit2.git] / src / object_api.c
CommitLineData
0b726701
VM
1/*
2 * Copyright (C) the libgit2 contributors. All rights reserved.
3 *
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
6 */
7#include "git2/object.h"
8
9#include "common.h"
10#include "repository.h"
11
12#include "commit.h"
13#include "tree.h"
14#include "blob.h"
15#include "tag.h"
16
17/**
18 * Blob
19 */
20int git_commit_lookup(git_commit **out, git_repository *repo, const git_oid *id)
21{
22 return git_object_lookup((git_object **)out, repo, id, GIT_OBJ_COMMIT);
23}
24
25int git_commit_lookup_prefix(git_commit **out, git_repository *repo, const git_oid *id, size_t len)
26{
27 return git_object_lookup_prefix((git_object **)out, repo, id, len, GIT_OBJ_COMMIT);
28}
29
30void git_commit_free(git_commit *obj)
31{
32 git_object_free((git_object *)obj);
33}
34
35const git_oid *git_commit_id(const git_commit *obj)
36{
37 return git_object_id((const git_object *)obj);
38}
39
40git_repository *git_commit_owner(const git_commit *obj)
41{
42 return git_object_owner((const git_object *)obj);
43}
44
45
46/**
47 * Tree
48 */
49int git_tree_lookup(git_tree **out, git_repository *repo, const git_oid *id)
50{
7dcda3aa 51 return git_object_lookup((git_object **)out, repo, id, GIT_OBJ_TREE);
0b726701
VM
52}
53
54int git_tree_lookup_prefix(git_tree **out, git_repository *repo, const git_oid *id, size_t len)
55{
7dcda3aa 56 return git_object_lookup_prefix((git_object **)out, repo, id, len, GIT_OBJ_TREE);
0b726701
VM
57}
58
59void git_tree_free(git_tree *obj)
60{
61 git_object_free((git_object *)obj);
62}
63
64const git_oid *git_tree_id(const git_tree *obj)
65{
66 return git_object_id((const git_object *)obj);
67}
68
69git_repository *git_tree_owner(const git_tree *obj)
70{
71 return git_object_owner((const git_object *)obj);
72}
73
74
75/**
76 * Tag
77 */
78int git_tag_lookup(git_tag **out, git_repository *repo, const git_oid *id)
79{
7dcda3aa 80 return git_object_lookup((git_object **)out, repo, id, GIT_OBJ_TAG);
0b726701
VM
81}
82
83int git_tag_lookup_prefix(git_tag **out, git_repository *repo, const git_oid *id, size_t len)
84{
7dcda3aa 85 return git_object_lookup_prefix((git_object **)out, repo, id, len, GIT_OBJ_TAG);
0b726701
VM
86}
87
88void git_tag_free(git_tag *obj)
89{
90 git_object_free((git_object *)obj);
91}
92
93const git_oid *git_tag_id(const git_tag *obj)
94{
95 return git_object_id((const git_object *)obj);
96}
97
98git_repository *git_tag_owner(const git_tag *obj)
99{
100 return git_object_owner((const git_object *)obj);
101}
102
103/**
104 * Blob
105 */
106int git_blob_lookup(git_blob **out, git_repository *repo, const git_oid *id)
107{
7dcda3aa 108 return git_object_lookup((git_object **)out, repo, id, GIT_OBJ_BLOB);
0b726701
VM
109}
110
111int git_blob_lookup_prefix(git_blob **out, git_repository *repo, const git_oid *id, size_t len)
112{
7dcda3aa 113 return git_object_lookup_prefix((git_object **)out, repo, id, len, GIT_OBJ_BLOB);
0b726701
VM
114}
115
116void git_blob_free(git_blob *obj)
117{
118 git_object_free((git_object *)obj);
119}
120
121const git_oid *git_blob_id(const git_blob *obj)
122{
123 return git_object_id((const git_object *)obj);
124}
125
126git_repository *git_blob_owner(const git_blob *obj)
127{
128 return git_object_owner((const git_object *)obj);
129}