]>
Commit | Line | Data |
---|---|---|
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 | */ | |
20 | int 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 | ||
25 | int 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 | ||
30 | void git_commit_free(git_commit *obj) | |
31 | { | |
32 | git_object_free((git_object *)obj); | |
33 | } | |
34 | ||
35 | const git_oid *git_commit_id(const git_commit *obj) | |
36 | { | |
37 | return git_object_id((const git_object *)obj); | |
38 | } | |
39 | ||
40 | git_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 | */ | |
49 | int 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 | ||
54 | int 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 | ||
59 | void git_tree_free(git_tree *obj) | |
60 | { | |
61 | git_object_free((git_object *)obj); | |
62 | } | |
63 | ||
64 | const git_oid *git_tree_id(const git_tree *obj) | |
65 | { | |
66 | return git_object_id((const git_object *)obj); | |
67 | } | |
68 | ||
69 | git_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 | */ | |
78 | int 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 | ||
83 | int 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 | ||
88 | void git_tag_free(git_tag *obj) | |
89 | { | |
90 | git_object_free((git_object *)obj); | |
91 | } | |
92 | ||
93 | const git_oid *git_tag_id(const git_tag *obj) | |
94 | { | |
95 | return git_object_id((const git_object *)obj); | |
96 | } | |
97 | ||
98 | git_repository *git_tag_owner(const git_tag *obj) | |
99 | { | |
100 | return git_object_owner((const git_object *)obj); | |
101 | } | |
102 | ||
103 | /** | |
104 | * Blob | |
105 | */ | |
106 | int 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 | ||
111 | int 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 | ||
116 | void git_blob_free(git_blob *obj) | |
117 | { | |
118 | git_object_free((git_object *)obj); | |
119 | } | |
120 | ||
121 | const git_oid *git_blob_id(const git_blob *obj) | |
122 | { | |
123 | return git_object_id((const git_object *)obj); | |
124 | } | |
125 | ||
126 | git_repository *git_blob_owner(const git_blob *obj) | |
127 | { | |
128 | return git_object_owner((const git_object *)obj); | |
129 | } |