Blame


1 718b3ab0 2018-03-17 stsp /*
2 718b3ab0 2018-03-17 stsp * Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
3 718b3ab0 2018-03-17 stsp *
4 718b3ab0 2018-03-17 stsp * Permission to use, copy, modify, and distribute this software for any
5 718b3ab0 2018-03-17 stsp * purpose with or without fee is hereby granted, provided that the above
6 718b3ab0 2018-03-17 stsp * copyright notice and this permission notice appear in all copies.
7 718b3ab0 2018-03-17 stsp *
8 718b3ab0 2018-03-17 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 718b3ab0 2018-03-17 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 718b3ab0 2018-03-17 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 718b3ab0 2018-03-17 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 718b3ab0 2018-03-17 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 718b3ab0 2018-03-17 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 718b3ab0 2018-03-17 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 718b3ab0 2018-03-17 stsp */
16 718b3ab0 2018-03-17 stsp
17 718b3ab0 2018-03-17 stsp struct got_object_id {
18 718b3ab0 2018-03-17 stsp u_int8_t sha1[SHA1_DIGEST_LENGTH];
19 718b3ab0 2018-03-17 stsp };
20 718b3ab0 2018-03-17 stsp
21 718b3ab0 2018-03-17 stsp struct got_object {
22 718b3ab0 2018-03-17 stsp int type;
23 718b3ab0 2018-03-17 stsp int flags;
24 718b3ab0 2018-03-17 stsp #define GOT_OBJ_FLAG_PACKED 0x01
25 718b3ab0 2018-03-17 stsp #define GOT_OBJ_FLAG_DELTIFIED 0x02
26 718b3ab0 2018-03-17 stsp
27 718b3ab0 2018-03-17 stsp size_t hdrlen;
28 718b3ab0 2018-03-17 stsp size_t size;
29 718b3ab0 2018-03-17 stsp struct got_object_id id;
30 718b3ab0 2018-03-17 stsp
31 718b3ab0 2018-03-17 stsp char *path_packfile; /* if packed */
32 c59b3346 2018-09-11 stsp int pack_idx; /* if packed */
33 718b3ab0 2018-03-17 stsp off_t pack_offset; /* if packed */
34 718b3ab0 2018-03-17 stsp struct got_delta_chain deltas; /* if deltified */
35 7bb0daa1 2018-06-21 stsp int refcnt; /* > 0 if open and/or cached */
36 718b3ab0 2018-03-17 stsp };
37 718b3ab0 2018-03-17 stsp
38 883f0469 2018-06-23 stsp struct got_tree_object {
39 883f0469 2018-06-23 stsp struct got_tree_entries entries;
40 883f0469 2018-06-23 stsp int refcnt;
41 883f0469 2018-06-23 stsp };
42 883f0469 2018-06-23 stsp
43 718b3ab0 2018-03-17 stsp struct got_blob_object {
44 718b3ab0 2018-03-17 stsp FILE *f;
45 718b3ab0 2018-03-17 stsp struct got_zstream_buf zb;
46 718b3ab0 2018-03-17 stsp size_t hdrlen;
47 718b3ab0 2018-03-17 stsp size_t blocksize;
48 718b3ab0 2018-03-17 stsp uint8_t *read_buf;
49 718b3ab0 2018-03-17 stsp struct got_object_id id;
50 718b3ab0 2018-03-17 stsp };
51 7762fe12 2018-11-05 stsp
52 7762fe12 2018-11-05 stsp /* Small version of got_commit_object. Used by commit graph. */
53 7762fe12 2018-11-05 stsp struct got_commit_object_mini {
54 7762fe12 2018-11-05 stsp struct got_object_id *tree_id;
55 7762fe12 2018-11-05 stsp unsigned int nparents;
56 7762fe12 2018-11-05 stsp struct got_object_id_queue parent_ids;
57 7762fe12 2018-11-05 stsp struct tm tm_committer; /* UTC */
58 e32baab7 2018-11-05 stsp int refcnt; /* > 0 if open and/or cached */
59 7762fe12 2018-11-05 stsp };
60 7762fe12 2018-11-05 stsp
61 7762fe12 2018-11-05 stsp const struct got_error *
62 e32baab7 2018-11-05 stsp got_object_mini_commit_open(struct got_commit_object_mini **,
63 e32baab7 2018-11-05 stsp struct got_repository *, struct got_object *);
64 7762fe12 2018-11-05 stsp void got_object_mini_commit_close(struct got_commit_object_mini *);
65 e32baab7 2018-11-05 stsp const struct got_error *got_object_open_as_mini_commit(
66 e32baab7 2018-11-05 stsp struct got_commit_object_mini **, struct got_repository *,
67 e32baab7 2018-11-05 stsp struct got_object_id *);