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 d1cda826 2017-11-06 stsp
21 0ffeb3c2 2017-11-26 stsp struct got_tree_entry {
22 0ffeb3c2 2017-11-26 stsp SIMPLEQ_ENTRY(got_tree_entry) entry;
23 0ffeb3c2 2017-11-26 stsp mode_t mode;
24 0ffeb3c2 2017-11-26 stsp char *name;
25 59ece79d 2018-02-12 stsp struct got_object_id *id;
26 0ffeb3c2 2017-11-26 stsp };
27 0ffeb3c2 2017-11-26 stsp
28 d1cda826 2017-11-06 stsp struct got_tree_object {
29 0ffeb3c2 2017-11-26 stsp int nentries;
30 0ffeb3c2 2017-11-26 stsp SIMPLEQ_HEAD(, got_tree_entry) entries;
31 d1cda826 2017-11-06 stsp };
32 d1cda826 2017-11-06 stsp
33 d1cda826 2017-11-06 stsp struct got_parent_id {
34 d1cda826 2017-11-06 stsp SIMPLEQ_ENTRY(got_parent_id) entry;
35 59ece79d 2018-02-12 stsp struct got_object_id *id;
36 d1cda826 2017-11-06 stsp };
37 d1cda826 2017-11-06 stsp
38 d1cda826 2017-11-06 stsp struct got_commit_object {
39 59ece79d 2018-02-12 stsp struct got_object_id *tree_id;
40 d1cda826 2017-11-06 stsp unsigned int nparents;
41 d1cda826 2017-11-06 stsp SIMPLEQ_HEAD(, got_parent_id) parent_ids;
42 d1cda826 2017-11-06 stsp char *author;
43 d1cda826 2017-11-06 stsp char *committer;
44 d1cda826 2017-11-06 stsp char *logmsg;
45 d1cda826 2017-11-06 stsp };
46 d1cda826 2017-11-06 stsp
47 eef6493a 2018-01-19 stsp struct got_object;
48 9b1d5162 2017-12-03 stsp #define GOT_OBJ_TYPE_COMMIT 1
49 9b1d5162 2017-12-03 stsp #define GOT_OBJ_TYPE_TREE 2
50 9b1d5162 2017-12-03 stsp #define GOT_OBJ_TYPE_BLOB 3
51 9b1d5162 2017-12-03 stsp #define GOT_OBJ_TYPE_TAG 4
52 f9a4270b 2017-12-03 stsp /* 5 is reserved */
53 9b1d5162 2017-12-03 stsp #define GOT_OBJ_TYPE_OFFSET_DELTA 6
54 9b1d5162 2017-12-03 stsp #define GOT_OBJ_TYPE_REF_DELTA 7
55 ab9a70b2 2017-11-06 stsp
56 ab9a70b2 2017-11-06 stsp struct got_repository;
57 ab9a70b2 2017-11-06 stsp
58 ef0981d5 2018-02-12 stsp const struct got_error *got_object_id_str(char **, struct got_object_id *);
59 a1fd68d8 2018-01-12 stsp int got_object_id_cmp(struct got_object_id *, struct got_object_id *);
60 8bf5b3c9 2018-03-17 stsp struct got_object_id *got_object_id_dup(struct got_object_id *);
61 b107e67f 2018-01-19 stsp int got_object_get_type(struct got_object *);
62 ab9a70b2 2017-11-06 stsp const struct got_error *got_object_open(struct got_object **,
63 ab9a70b2 2017-11-06 stsp struct got_repository *, struct got_object_id *);
64 6dfa2fd3 2018-02-12 stsp const struct got_error *got_object_open_by_id_str(struct got_object **,
65 6dfa2fd3 2018-02-12 stsp struct got_repository *, const char *);
66 ab9a70b2 2017-11-06 stsp void got_object_close(struct got_object *);
67 d1cda826 2017-11-06 stsp const struct got_error *got_object_commit_open(struct got_commit_object **,
68 d1cda826 2017-11-06 stsp struct got_repository *, struct got_object *);
69 d1cda826 2017-11-06 stsp void got_object_commit_close(struct got_commit_object *);
70 0ffeb3c2 2017-11-26 stsp const struct got_error *got_object_tree_open(struct got_tree_object **,
71 0ffeb3c2 2017-11-26 stsp struct got_repository *, struct got_object *);
72 0ffeb3c2 2017-11-26 stsp void got_object_tree_close(struct got_tree_object *);
73 68482ea3 2017-11-27 stsp const struct got_error *got_object_blob_open(struct got_blob_object **,
74 68482ea3 2017-11-27 stsp struct got_repository *, struct got_object *, size_t);
75 68482ea3 2017-11-27 stsp void got_object_blob_close(struct got_blob_object *);
76 f934cf2c 2018-02-12 stsp char *got_object_blob_id_str(struct got_blob_object*, char *, size_t);
77 f934cf2c 2018-02-12 stsp size_t got_object_blob_get_hdrlen(struct got_blob_object *);
78 f934cf2c 2018-02-12 stsp const uint8_t *got_object_blob_get_read_buf(struct got_blob_object *);
79 eb651edf 2018-02-11 stsp const struct got_error *got_object_blob_read_block(size_t *,
80 eb651edf 2018-02-11 stsp struct got_blob_object *);