Blame


1 7b19e0f1 2017-11-05 stsp /*
2 a1fd68d8 2018-01-12 stsp * Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
3 7b19e0f1 2017-11-05 stsp *
4 7b19e0f1 2017-11-05 stsp * Permission to use, copy, modify, and distribute this software for any
5 7b19e0f1 2017-11-05 stsp * purpose with or without fee is hereby granted, provided that the above
6 7b19e0f1 2017-11-05 stsp * copyright notice and this permission notice appear in all copies.
7 7b19e0f1 2017-11-05 stsp *
8 7b19e0f1 2017-11-05 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 7b19e0f1 2017-11-05 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 7b19e0f1 2017-11-05 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 7b19e0f1 2017-11-05 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 7b19e0f1 2017-11-05 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 7b19e0f1 2017-11-05 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 7b19e0f1 2017-11-05 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 7b19e0f1 2017-11-05 stsp */
16 7b19e0f1 2017-11-05 stsp
17 59ece79d 2018-02-12 stsp struct got_object_id;
18 d71d75ad 2017-11-05 stsp
19 f934cf2c 2018-02-12 stsp struct got_blob_object;
20 883f0469 2018-06-23 stsp struct got_tree_object;
21 56e0773d 2019-11-28 stsp struct got_tree_entry;
22 f4a881ce 2018-11-17 stsp struct got_tag_object;
23 45d799e2 2018-12-23 stsp struct got_commit_object;
24 d1cda826 2017-11-06 stsp
25 79f35eb3 2018-06-11 stsp struct got_object_qid {
26 dbdddfee 2021-06-23 naddy STAILQ_ENTRY(got_object_qid) entry;
27 59ece79d 2018-02-12 stsp struct got_object_id *id;
28 74a2356f 2021-06-18 stsp void *data; /* managed by API user */
29 d1cda826 2017-11-06 stsp };
30 d1cda826 2017-11-06 stsp
31 dbdddfee 2021-06-23 naddy STAILQ_HEAD(got_object_id_queue, got_object_qid);
32 b43fbaa0 2018-06-11 stsp
33 dbc6a6b6 2018-07-12 stsp const struct got_error *got_object_qid_alloc(struct got_object_qid **,
34 dbc6a6b6 2018-07-12 stsp struct got_object_id *);
35 dbc6a6b6 2018-07-12 stsp void got_object_qid_free(struct got_object_qid *);
36 dd88155e 2019-06-29 stsp void got_object_id_queue_free(struct got_object_id_queue *);
37 dbc6a6b6 2018-07-12 stsp
38 9ca9aafb 2021-06-18 stsp /*
39 9ca9aafb 2021-06-18 stsp * Deep-copy elements from ID queue src to ID queue dest. Do not copy any
40 9ca9aafb 2021-06-18 stsp * qid->data pointers! This is the caller's responsibility if needed.
41 9ca9aafb 2021-06-18 stsp */
42 9ca9aafb 2021-06-18 stsp const struct got_error *got_object_id_queue_copy(
43 9ca9aafb 2021-06-18 stsp const struct got_object_id_queue *src, struct got_object_id_queue *dest);
44 9ca9aafb 2021-06-18 stsp
45 15a94983 2018-12-23 stsp /* Object types. */
46 dd88155e 2019-06-29 stsp #define GOT_OBJ_TYPE_ANY 0 /* wildcard value at run-time */
47 9b1d5162 2017-12-03 stsp #define GOT_OBJ_TYPE_COMMIT 1
48 9b1d5162 2017-12-03 stsp #define GOT_OBJ_TYPE_TREE 2
49 9b1d5162 2017-12-03 stsp #define GOT_OBJ_TYPE_BLOB 3
50 9b1d5162 2017-12-03 stsp #define GOT_OBJ_TYPE_TAG 4
51 f9a4270b 2017-12-03 stsp /* 5 is reserved */
52 9b1d5162 2017-12-03 stsp #define GOT_OBJ_TYPE_OFFSET_DELTA 6
53 9b1d5162 2017-12-03 stsp #define GOT_OBJ_TYPE_REF_DELTA 7
54 ab9a70b2 2017-11-06 stsp
55 8aa93786 2019-08-22 stsp /*
56 8aa93786 2019-08-22 stsp * Labels used in object data.
57 8aa93786 2019-08-22 stsp */
58 8aa93786 2019-08-22 stsp
59 8aa93786 2019-08-22 stsp #define GOT_OBJ_LABEL_COMMIT "commit"
60 8aa93786 2019-08-22 stsp #define GOT_OBJ_LABEL_TREE "tree"
61 8aa93786 2019-08-22 stsp #define GOT_OBJ_LABEL_BLOB "blob"
62 8aa93786 2019-08-22 stsp #define GOT_OBJ_LABEL_TAG "tag"
63 8aa93786 2019-08-22 stsp
64 8aa93786 2019-08-22 stsp #define GOT_COMMIT_LABEL_TREE "tree "
65 8aa93786 2019-08-22 stsp #define GOT_COMMIT_LABEL_PARENT "parent "
66 8aa93786 2019-08-22 stsp #define GOT_COMMIT_LABEL_AUTHOR "author "
67 8aa93786 2019-08-22 stsp #define GOT_COMMIT_LABEL_COMMITTER "committer "
68 8aa93786 2019-08-22 stsp
69 8aa93786 2019-08-22 stsp #define GOT_TAG_LABEL_OBJECT "object "
70 8aa93786 2019-08-22 stsp #define GOT_TAG_LABEL_TYPE "type "
71 8aa93786 2019-08-22 stsp #define GOT_TAG_LABEL_TAG "tag "
72 8aa93786 2019-08-22 stsp #define GOT_TAG_LABEL_TAGGER "tagger "
73 8aa93786 2019-08-22 stsp
74 ab9a70b2 2017-11-06 stsp struct got_repository;
75 ab9a70b2 2017-11-06 stsp
76 0c60ce5a 2018-04-02 stsp /*
77 0c60ce5a 2018-04-02 stsp * Obtain a string representation of an object ID. The output depends on
78 0c60ce5a 2018-04-02 stsp * the hash function used by the repository format (currently SHA1).
79 0c60ce5a 2018-04-02 stsp */
80 ef0981d5 2018-02-12 stsp const struct got_error *got_object_id_str(char **, struct got_object_id *);
81 0c60ce5a 2018-04-02 stsp
82 0c60ce5a 2018-04-02 stsp /*
83 0c60ce5a 2018-04-02 stsp * Compare two object IDs. Return value behaves like memcmp(3).
84 0c60ce5a 2018-04-02 stsp */
85 984e8a45 2018-11-05 stsp int got_object_id_cmp(const struct got_object_id *,
86 984e8a45 2018-11-05 stsp const struct got_object_id *);
87 0c60ce5a 2018-04-02 stsp
88 0c60ce5a 2018-04-02 stsp /*
89 0c60ce5a 2018-04-02 stsp * Created a newly allocated copy of an object ID.
90 0c60ce5a 2018-04-02 stsp * The caller should dispose of it with free(3).
91 0c60ce5a 2018-04-02 stsp */
92 8bf5b3c9 2018-03-17 stsp struct got_object_id *got_object_id_dup(struct got_object_id *);
93 0c60ce5a 2018-04-02 stsp
94 0c60ce5a 2018-04-02 stsp /*
95 27d434c2 2018-09-15 stsp * Get a newly allocated ID of the object which resides at the specified
96 67b631c9 2021-10-10 stsp * path in the specified tree.
97 67b631c9 2021-10-10 stsp * The caller should dispose of it with free(3).
98 67b631c9 2021-10-10 stsp */
99 67b631c9 2021-10-10 stsp const struct got_error *got_object_tree_find_path(struct got_object_id **id,
100 67b631c9 2021-10-10 stsp mode_t *mode, struct got_repository *repo, struct got_tree_object *tree,
101 67b631c9 2021-10-10 stsp const char *path);
102 67b631c9 2021-10-10 stsp
103 67b631c9 2021-10-10 stsp /*
104 67b631c9 2021-10-10 stsp * Get a newly allocated ID of the object which resides at the specified
105 27d434c2 2018-09-15 stsp * path in the tree of the specified commit.
106 27d434c2 2018-09-15 stsp * The caller should dispose of it with free(3).
107 27d434c2 2018-09-15 stsp */
108 6c34b1aa 2019-03-18 stsp const struct got_error *got_object_id_by_path(struct got_object_id **,
109 6c34b1aa 2019-03-18 stsp struct got_repository *, struct got_object_id *, const char *);
110 27d434c2 2018-09-15 stsp
111 27d434c2 2018-09-15 stsp /*
112 0c60ce5a 2018-04-02 stsp * Obtain the type of an object.
113 0c60ce5a 2018-04-02 stsp * Returns one of the GOT_OBJ_TYPE_x values (see above).
114 0c60ce5a 2018-04-02 stsp */
115 15a94983 2018-12-23 stsp const struct got_error *got_object_get_type(int *, struct got_repository *,
116 15a94983 2018-12-23 stsp struct got_object_id *);
117 0c60ce5a 2018-04-02 stsp
118 0c60ce5a 2018-04-02 stsp /*
119 15a94983 2018-12-23 stsp * Attempt to resolve the textual representation of an object ID
120 15a94983 2018-12-23 stsp * to the ID of an existing object in the repository.
121 15a94983 2018-12-23 stsp * The caller should dispose of the ID with free(3).
122 0c60ce5a 2018-04-02 stsp */
123 6c34b1aa 2019-03-18 stsp const struct got_error *got_object_resolve_id_str(struct got_object_id **,
124 6c34b1aa 2019-03-18 stsp struct got_repository *, const char *);
125 0c60ce5a 2018-04-02 stsp
126 0c60ce5a 2018-04-02 stsp /*
127 0c60ce5a 2018-04-02 stsp * Attempt to open a commit object in a repository.
128 0c60ce5a 2018-04-02 stsp * The caller must dispose of the commit with got_object_commit_close().
129 0c60ce5a 2018-04-02 stsp */
130 6c34b1aa 2019-03-18 stsp const struct got_error *got_object_open_as_commit(struct got_commit_object **,
131 15a94983 2018-12-23 stsp struct got_repository *, struct got_object_id *);
132 0c60ce5a 2018-04-02 stsp
133 0c60ce5a 2018-04-02 stsp /* Dispose of a commit object. */
134 d1cda826 2017-11-06 stsp void got_object_commit_close(struct got_commit_object *);
135 0c60ce5a 2018-04-02 stsp
136 45d799e2 2018-12-23 stsp /* Obtain the ID of the tree created in a commit. */
137 45d799e2 2018-12-23 stsp struct got_object_id *got_object_commit_get_tree_id(struct got_commit_object *);
138 45d799e2 2018-12-23 stsp
139 45d799e2 2018-12-23 stsp /* Obtain the number of parent commits of a commit. */
140 45d799e2 2018-12-23 stsp int got_object_commit_get_nparents(struct got_commit_object *);
141 45d799e2 2018-12-23 stsp
142 45d799e2 2018-12-23 stsp /* Obtain the list of parent commits of a commit. */
143 45d799e2 2018-12-23 stsp const struct got_object_id_queue *got_object_commit_get_parent_ids(
144 45d799e2 2018-12-23 stsp struct got_commit_object *);
145 45d799e2 2018-12-23 stsp
146 45d799e2 2018-12-23 stsp /* Get the author's name and email address. */
147 45d799e2 2018-12-23 stsp const char *got_object_commit_get_author(struct got_commit_object *);
148 45d799e2 2018-12-23 stsp
149 2df4e4ff 2018-12-23 stsp /* Get an author's commit timestamp in UTC. */
150 45d799e2 2018-12-23 stsp time_t got_object_commit_get_author_time(struct got_commit_object *);
151 45d799e2 2018-12-23 stsp
152 45d799e2 2018-12-23 stsp /* Get an author's timezone offset. */
153 45d799e2 2018-12-23 stsp time_t got_object_commit_get_author_gmtoff(struct got_commit_object *);
154 45d799e2 2018-12-23 stsp
155 45d799e2 2018-12-23 stsp /* Get the committer's name and email address. */
156 45d799e2 2018-12-23 stsp const char *got_object_commit_get_committer(struct got_commit_object *);
157 45d799e2 2018-12-23 stsp
158 450eaa8b 2018-12-23 stsp /* Get a committer's commit timestamp in UTC. */
159 45d799e2 2018-12-23 stsp time_t got_object_commit_get_committer_time(struct got_commit_object *);
160 45d799e2 2018-12-23 stsp
161 450eaa8b 2018-12-23 stsp /* Get a committer's timezone offset. */
162 45d799e2 2018-12-23 stsp time_t got_object_commit_get_committer_gmtoff(struct got_commit_object *);
163 45d799e2 2018-12-23 stsp
164 24ea5512 2019-08-22 stsp /*
165 24ea5512 2019-08-22 stsp * Get the commit log message.
166 24ea5512 2019-08-22 stsp * PGP-signatures contained in the log message will be stripped.
167 24ea5512 2019-08-22 stsp * The caller must dispose of it with free(3).
168 24ea5512 2019-08-22 stsp */
169 5943eee2 2019-08-13 stsp const struct got_error *got_object_commit_get_logmsg(char **,
170 5943eee2 2019-08-13 stsp struct got_commit_object *);
171 45d799e2 2018-12-23 stsp
172 24ea5512 2019-08-22 stsp /* Get the raw commit log message.*/
173 24ea5512 2019-08-22 stsp const char *got_object_commit_get_logmsg_raw(struct got_commit_object *);
174 24ea5512 2019-08-22 stsp
175 0c60ce5a 2018-04-02 stsp /*
176 0c60ce5a 2018-04-02 stsp * Attempt to open a tree object in a repository.
177 0c60ce5a 2018-04-02 stsp * The caller must dispose of the tree with got_object_tree_close().
178 0c60ce5a 2018-04-02 stsp */
179 6c34b1aa 2019-03-18 stsp const struct got_error *got_object_open_as_tree(struct got_tree_object **,
180 15a94983 2018-12-23 stsp struct got_repository *, struct got_object_id *);
181 0c60ce5a 2018-04-02 stsp
182 0c60ce5a 2018-04-02 stsp /* Dispose of a tree object. */
183 0ffeb3c2 2017-11-26 stsp void got_object_tree_close(struct got_tree_object *);
184 0c60ce5a 2018-04-02 stsp
185 56e0773d 2019-11-28 stsp /* Get the number of entries in this tree object. */
186 56e0773d 2019-11-28 stsp int got_object_tree_get_nentries(struct got_tree_object *);
187 883f0469 2018-06-23 stsp
188 56e0773d 2019-11-28 stsp /* Get the first tree entry from a tree, or NULL if there is none. */
189 c0df5966 2021-12-31 stsp struct got_tree_entry *got_object_tree_get_first_entry(
190 c0df5966 2021-12-31 stsp struct got_tree_object *);
191 56e0773d 2019-11-28 stsp
192 56e0773d 2019-11-28 stsp /* Get the last tree entry from a tree, or NULL if there is none. */
193 56e0773d 2019-11-28 stsp struct got_tree_entry *got_object_tree_get_last_entry(struct got_tree_object *);
194 56e0773d 2019-11-28 stsp
195 56e0773d 2019-11-28 stsp /* Get the entry with the specified index from a tree object. */
196 56e0773d 2019-11-28 stsp struct got_tree_entry *got_object_tree_get_entry(
197 56e0773d 2019-11-28 stsp struct got_tree_object *, int);
198 56e0773d 2019-11-28 stsp
199 56e0773d 2019-11-28 stsp /* Find a particular entry in a tree by name. */
200 56e0773d 2019-11-28 stsp struct got_tree_entry *got_object_tree_find_entry(
201 a129376b 2019-03-28 stsp struct got_tree_object *, const char *);
202 a129376b 2019-03-28 stsp
203 56e0773d 2019-11-28 stsp /* Get the file permission mode of a tree entry. */
204 56e0773d 2019-11-28 stsp mode_t got_tree_entry_get_mode(struct got_tree_entry *);
205 56e0773d 2019-11-28 stsp
206 56e0773d 2019-11-28 stsp /* Get the name of a tree entry. */
207 56e0773d 2019-11-28 stsp const char *got_tree_entry_get_name(struct got_tree_entry *);
208 56e0773d 2019-11-28 stsp
209 56e0773d 2019-11-28 stsp /* Get the object ID of a tree entry. */
210 56e0773d 2019-11-28 stsp struct got_object_id *got_tree_entry_get_id(struct got_tree_entry *);
211 56e0773d 2019-11-28 stsp
212 0d6c6ee3 2020-05-20 stsp /*
213 0d6c6ee3 2020-05-20 stsp * Get a string containing the target path of a given a symlink tree entry.
214 0d6c6ee3 2020-05-20 stsp * The caller should dispose of it with free(3).
215 0d6c6ee3 2020-05-20 stsp */
216 0d6c6ee3 2020-05-20 stsp const struct got_error *got_tree_entry_get_symlink_target(char **,
217 0d6c6ee3 2020-05-20 stsp struct got_tree_entry *, struct got_repository *);
218 0d6c6ee3 2020-05-20 stsp
219 56e0773d 2019-11-28 stsp /* Get the index of a tree entry. */
220 56e0773d 2019-11-28 stsp int got_tree_entry_get_index(struct got_tree_entry *);
221 56e0773d 2019-11-28 stsp
222 56e0773d 2019-11-28 stsp /* Get the next tree entry from a tree, or NULL if there is none. */
223 56e0773d 2019-11-28 stsp struct got_tree_entry *got_tree_entry_get_next(struct got_tree_object *,
224 56e0773d 2019-11-28 stsp struct got_tree_entry *);
225 56e0773d 2019-11-28 stsp
226 56e0773d 2019-11-28 stsp /* Get the previous tree entry from a tree, or NULL if there is none. */
227 56e0773d 2019-11-28 stsp struct got_tree_entry *got_tree_entry_get_prev(struct got_tree_object *,
228 56e0773d 2019-11-28 stsp struct got_tree_entry *);
229 56e0773d 2019-11-28 stsp
230 63c5ca5d 2019-08-24 stsp /* Return non-zero if the specified tree entry is a Git submodule. */
231 56e0773d 2019-11-28 stsp int got_object_tree_entry_is_submodule(struct got_tree_entry *);
232 63c5ca5d 2019-08-24 stsp
233 e40622f4 2020-07-23 stsp /* Return non-zero if the specified tree entry is a symbolic link. */
234 e40622f4 2020-07-23 stsp int got_object_tree_entry_is_symlink(struct got_tree_entry *);
235 e40622f4 2020-07-23 stsp
236 0c60ce5a 2018-04-02 stsp /*
237 e40622f4 2020-07-23 stsp * Resolve an in-repository symlink at the specified path in the tree
238 e40622f4 2020-07-23 stsp * corresponding to the specified commit. If the specified path is not
239 e40622f4 2020-07-23 stsp * a symlink then set *link_target to NULL.
240 e40622f4 2020-07-23 stsp * Otherwise, resolve symlinks recursively and return the final link
241 e40622f4 2020-07-23 stsp * target path. The caller must dispose of it with free(3).
242 e40622f4 2020-07-23 stsp */
243 e40622f4 2020-07-23 stsp const struct got_error *got_object_resolve_symlinks(char **, const char *,
244 e40622f4 2020-07-23 stsp struct got_object_id *, struct got_repository *);
245 e40622f4 2020-07-23 stsp
246 e40622f4 2020-07-23 stsp /*
247 07862c20 2018-09-15 stsp * Compare two trees and indicate whether the entry at the specified path
248 31cedeaf 2018-09-15 stsp * differs between them. The path must not be the root path "/"; the function
249 31cedeaf 2018-09-15 stsp * got_object_id_cmp() should be used instead to compare the tree roots.
250 07862c20 2018-09-15 stsp */
251 07862c20 2018-09-15 stsp const struct got_error *got_object_tree_path_changed(int *,
252 07862c20 2018-09-15 stsp struct got_tree_object *, struct got_tree_object *, const char *,
253 07862c20 2018-09-15 stsp struct got_repository *);
254 07862c20 2018-09-15 stsp
255 07862c20 2018-09-15 stsp /*
256 0c60ce5a 2018-04-02 stsp * Attempt to open a blob object in a repository.
257 0c60ce5a 2018-04-02 stsp * The size_t argument specifies the block size of an associated read buffer.
258 0c60ce5a 2018-04-02 stsp * The caller must dispose of the blob with got_object_blob_close().
259 0c60ce5a 2018-04-02 stsp */
260 6c34b1aa 2019-03-18 stsp const struct got_error *got_object_open_as_blob(struct got_blob_object **,
261 15a94983 2018-12-23 stsp struct got_repository *, struct got_object_id *, size_t);
262 0c60ce5a 2018-04-02 stsp
263 0c60ce5a 2018-04-02 stsp /* Dispose of a blob object. */
264 fb43ecf1 2019-02-11 stsp const struct got_error *got_object_blob_close(struct got_blob_object *);
265 0c60ce5a 2018-04-02 stsp
266 0c60ce5a 2018-04-02 stsp /*
267 0c60ce5a 2018-04-02 stsp * Get the length of header data at the beginning of the blob's read buffer.
268 0c60ce5a 2018-04-02 stsp * Note that header data is only present upon the first invocation of
269 0c60ce5a 2018-04-02 stsp * got_object_blob_read_block() after the blob is opened.
270 0c60ce5a 2018-04-02 stsp */
271 f934cf2c 2018-02-12 stsp size_t got_object_blob_get_hdrlen(struct got_blob_object *);
272 0c60ce5a 2018-04-02 stsp
273 0c60ce5a 2018-04-02 stsp /*
274 0c60ce5a 2018-04-02 stsp * Get a pointer to the blob's read buffer.
275 0c60ce5a 2018-04-02 stsp * The read buffer is filled by got_object_blob_read_block().
276 0c60ce5a 2018-04-02 stsp */
277 f934cf2c 2018-02-12 stsp const uint8_t *got_object_blob_get_read_buf(struct got_blob_object *);
278 0c60ce5a 2018-04-02 stsp
279 0c60ce5a 2018-04-02 stsp /*
280 0c60ce5a 2018-04-02 stsp * Read the next chunk of data from a blob, up to the blob's read buffer
281 0c60ce5a 2018-04-02 stsp * block size. The size_t output argument indicates how many bytes have
282 0c60ce5a 2018-04-02 stsp * been read into the blob's read buffer. Zero bytes will be reported if
283 0c60ce5a 2018-04-02 stsp * all data in the blob has been read.
284 0c60ce5a 2018-04-02 stsp */
285 eb651edf 2018-02-11 stsp const struct got_error *got_object_blob_read_block(size_t *,
286 eb651edf 2018-02-11 stsp struct got_blob_object *);
287 be6a1b5a 2018-06-11 stsp
288 8ba819a3 2020-07-23 stsp /* Rewind an open blob's data stream back to the beginning. */
289 8ba819a3 2020-07-23 stsp void got_object_blob_rewind(struct got_blob_object *);
290 8ba819a3 2020-07-23 stsp
291 35e9ba5d 2018-06-21 stsp /*
292 35e9ba5d 2018-06-21 stsp * Read the entire content of a blob and write it to the specified file.
293 84451b3e 2018-07-10 stsp * Flush and rewind the file as well. Indicate the amount of bytes
294 6c4c42e0 2019-06-24 stsp * written in the size_t output argument, and the number of lines in the
295 0f6650ff 2019-08-14 stsp * file in the int argument, and line offsets in the off_t argument
296 6c4c42e0 2019-06-24 stsp * (NULL can be passed for any output argument).
297 35e9ba5d 2018-06-21 stsp */
298 be659d10 2020-11-18 stsp const struct got_error *got_object_blob_dump_to_file(off_t *, int *,
299 6c4c42e0 2019-06-24 stsp off_t **, FILE *, struct got_blob_object *);
300 af57b12a 2020-07-23 stsp
301 af57b12a 2020-07-23 stsp /*
302 af57b12a 2020-07-23 stsp * Read the entire content of a blob into a newly allocated string buffer
303 af57b12a 2020-07-23 stsp * and terminate it with '\0'. This is intended for blobs which contain a
304 af57b12a 2020-07-23 stsp * symlink target path. It should not be used to process arbitrary blobs.
305 af57b12a 2020-07-23 stsp * Use got_object_blob_dump_to_file() or got_tree_entry_get_symlink_target()
306 af57b12a 2020-07-23 stsp * instead if possible. The caller must dispose of the string with free(3).
307 af57b12a 2020-07-23 stsp */
308 af57b12a 2020-07-23 stsp const struct got_error *got_object_blob_read_to_str(char **,
309 af57b12a 2020-07-23 stsp struct got_blob_object *);
310 35e9ba5d 2018-06-21 stsp
311 f4a881ce 2018-11-17 stsp /*
312 f4a881ce 2018-11-17 stsp * Attempt to open a tag object in a repository.
313 01073a5d 2019-08-22 stsp * The caller must dispose of the tree with got_tag_object_close().
314 f4a881ce 2018-11-17 stsp */
315 15a94983 2018-12-23 stsp const struct got_error *got_object_open_as_tag(struct got_tag_object **,
316 15a94983 2018-12-23 stsp struct got_repository *, struct got_object_id *);
317 f4a881ce 2018-11-17 stsp
318 f4a881ce 2018-11-17 stsp /* Dispose of a tag object. */
319 f4a881ce 2018-11-17 stsp void got_object_tag_close(struct got_tag_object *);
320 f4a881ce 2018-11-17 stsp
321 d24820bf 2019-08-11 stsp /* Get the name of a tag. */
322 d24820bf 2019-08-11 stsp const char *got_object_tag_get_name(struct got_tag_object *);
323 d24820bf 2019-08-11 stsp
324 0bd18d37 2019-02-01 stsp /* Get type of the object a tag points to. */
325 0bd18d37 2019-02-01 stsp int got_object_tag_get_object_type(struct got_tag_object *);
326 0bd18d37 2019-02-01 stsp
327 0bd18d37 2019-02-01 stsp /*
328 0bd18d37 2019-02-01 stsp * Get ID of the object a tag points to.
329 0bd18d37 2019-02-01 stsp * This must not be freed by the caller. Use got_object_id_dup() if needed.
330 0bd18d37 2019-02-01 stsp */
331 0bd18d37 2019-02-01 stsp struct got_object_id *got_object_tag_get_object_id(struct got_tag_object *);
332 0bd18d37 2019-02-01 stsp
333 01073a5d 2019-08-22 stsp
334 01073a5d 2019-08-22 stsp /* Get the timestamp of the tag. */
335 01073a5d 2019-08-22 stsp time_t got_object_tag_get_tagger_time(struct got_tag_object *);
336 01073a5d 2019-08-22 stsp
337 01073a5d 2019-08-22 stsp /* Get the tag's timestamp's GMT offset. */
338 01073a5d 2019-08-22 stsp time_t got_object_tag_get_tagger_gmtoff(struct got_tag_object *);
339 01073a5d 2019-08-22 stsp
340 01073a5d 2019-08-22 stsp /* Get the author of the tag. */
341 01073a5d 2019-08-22 stsp const char *got_object_tag_get_tagger(struct got_tag_object *);
342 01073a5d 2019-08-22 stsp
343 01073a5d 2019-08-22 stsp /* Get the tag message associated with the tag. */
344 01073a5d 2019-08-22 stsp const char *got_object_tag_get_message(struct got_tag_object *);
345 01073a5d 2019-08-22 stsp
346 bff6ca00 2018-04-23 stsp const struct got_error *got_object_commit_add_parent(struct got_commit_object *,
347 bff6ca00 2018-04-23 stsp const char *);
348 8e7bd50a 2019-08-22 stsp
349 8e7bd50a 2019-08-22 stsp /* Create a new tag object in the repository. */
350 8e7bd50a 2019-08-22 stsp const struct got_error *got_object_tag_create(struct got_object_id **,
351 8e7bd50a 2019-08-22 stsp const char *, struct got_object_id *, const char *,
352 8e7bd50a 2019-08-22 stsp time_t, const char *, struct got_repository *);