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 f6912001 2019-05-15 stsp #define GOT_PACKIDX_CACHE_SIZE 16
18 718b3ab0 2018-03-17 stsp #define GOT_PACK_CACHE_SIZE GOT_PACKIDX_CACHE_SIZE
19 718b3ab0 2018-03-17 stsp
20 718b3ab0 2018-03-17 stsp struct got_repository {
21 718b3ab0 2018-03-17 stsp char *path;
22 718b3ab0 2018-03-17 stsp char *path_git_dir;
23 718b3ab0 2018-03-17 stsp
24 718b3ab0 2018-03-17 stsp /* The pack index cache speeds up search for packed objects. */
25 6fd11751 2018-06-04 stsp struct got_packidx *packidx_cache[GOT_PACKIDX_CACHE_SIZE];
26 718b3ab0 2018-03-17 stsp
27 6c6d3ed3 2018-04-02 stsp /* Open file handles for pack files. */
28 718b3ab0 2018-03-17 stsp struct got_pack packs[GOT_PACK_CACHE_SIZE];
29 7bb0daa1 2018-06-21 stsp
30 ad242220 2018-09-08 stsp /* Handles to child processes for reading loose objects. */
31 f4a881ce 2018-11-17 stsp struct got_privsep_child privsep_children[5];
32 ad242220 2018-09-08 stsp #define GOT_REPO_PRIVSEP_CHILD_OBJECT 0
33 ad242220 2018-09-08 stsp #define GOT_REPO_PRIVSEP_CHILD_COMMIT 1
34 ad242220 2018-09-08 stsp #define GOT_REPO_PRIVSEP_CHILD_TREE 2
35 ad242220 2018-09-08 stsp #define GOT_REPO_PRIVSEP_CHILD_BLOB 3
36 f4a881ce 2018-11-17 stsp #define GOT_REPO_PRIVSEP_CHILD_TAG 4
37 ad242220 2018-09-08 stsp
38 ad242220 2018-09-08 stsp /* Caches for open objects. */
39 54f20211 2018-06-22 stsp struct got_object_cache objcache;
40 f6be5c30 2018-06-22 stsp struct got_object_cache treecache;
41 1943de01 2018-06-22 stsp struct got_object_cache commitcache;
42 f4a881ce 2018-11-17 stsp struct got_object_cache tagcache;
43 1d126e2d 2019-08-24 stsp
44 1d126e2d 2019-08-24 stsp /* Settings read from Git configuration files. */
45 aba9c984 2019-09-08 stsp int gitconfig_repository_format_version;
46 aba9c984 2019-09-08 stsp char *gitconfig_author_name;
47 aba9c984 2019-09-08 stsp char *gitconfig_author_email;
48 c9956ddf 2019-09-08 stsp char *global_gitconfig_author_name;
49 c9956ddf 2019-09-08 stsp char *global_gitconfig_author_email;
50 cd95becd 2019-11-29 stsp int ngitconfig_remotes;
51 cd95becd 2019-11-29 stsp struct got_remote_repo *gitconfig_remotes;
52 9a1cc63f 2020-02-03 stsp char *gitconfig_owner;
53 718b3ab0 2018-03-17 stsp };
54 7bb0daa1 2018-06-21 stsp
55 f6be5c30 2018-06-22 stsp const struct got_error*got_repo_cache_object(struct got_repository *,
56 f6be5c30 2018-06-22 stsp struct got_object_id *, struct got_object *);
57 7bb0daa1 2018-06-21 stsp struct got_object *got_repo_get_cached_object(struct got_repository *,
58 7bb0daa1 2018-06-21 stsp struct got_object_id *);
59 f6be5c30 2018-06-22 stsp const struct got_error*got_repo_cache_tree(struct got_repository *,
60 f6be5c30 2018-06-22 stsp struct got_object_id *, struct got_tree_object *);
61 f6be5c30 2018-06-22 stsp struct got_tree_object *got_repo_get_cached_tree(struct got_repository *,
62 f6be5c30 2018-06-22 stsp struct got_object_id *);
63 1943de01 2018-06-22 stsp const struct got_error*got_repo_cache_commit(struct got_repository *,
64 1943de01 2018-06-22 stsp struct got_object_id *, struct got_commit_object *);
65 1943de01 2018-06-22 stsp struct got_commit_object *got_repo_get_cached_commit(struct got_repository *,
66 1943de01 2018-06-22 stsp struct got_object_id *);
67 f4a881ce 2018-11-17 stsp const struct got_error*got_repo_cache_tag(struct got_repository *,
68 f4a881ce 2018-11-17 stsp struct got_object_id *, struct got_tag_object *);
69 f4a881ce 2018-11-17 stsp struct got_tag_object *got_repo_get_cached_tag(struct got_repository *,
70 f4a881ce 2018-11-17 stsp struct got_object_id *);
71 1510f469 2018-09-09 stsp const struct got_error *got_repo_search_packidx(struct got_packidx **, int *,
72 1510f469 2018-09-09 stsp struct got_repository *, struct got_object_id *);
73 1510f469 2018-09-09 stsp const struct got_error *got_repo_cache_pack(struct got_pack **,
74 1510f469 2018-09-09 stsp struct got_repository *, const char *, struct got_packidx *);