Blame


1 257add31 2020-09-09 stsp /*
2 cfd92333 2021-08-27 tracey * Copyright (c) 2020, 2021 Tracey Emery <tracey@openbsd.org>
3 257add31 2020-09-09 stsp * Copyright (c) 2020 Stefan Sperling <stsp@openbsd.org>
4 257add31 2020-09-09 stsp *
5 257add31 2020-09-09 stsp * Permission to use, copy, modify, and distribute this software for any
6 257add31 2020-09-09 stsp * purpose with or without fee is hereby granted, provided that the above
7 257add31 2020-09-09 stsp * copyright notice and this permission notice appear in all copies.
8 257add31 2020-09-09 stsp *
9 257add31 2020-09-09 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 257add31 2020-09-09 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 257add31 2020-09-09 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 257add31 2020-09-09 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 257add31 2020-09-09 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 257add31 2020-09-09 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 257add31 2020-09-09 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 257add31 2020-09-09 stsp */
17 257add31 2020-09-09 stsp
18 aaf30ee7 2021-08-29 stsp /*
19 aaf30ee7 2021-08-29 stsp * We maintain two different structures for fetch and send configuration
20 aaf30ee7 2021-08-29 stsp * settings in case they diverge in the future.
21 aaf30ee7 2021-08-29 stsp */
22 aaf30ee7 2021-08-29 stsp struct fetch_config {
23 aaf30ee7 2021-08-29 stsp char *repository;
24 aaf30ee7 2021-08-29 stsp char *server;
25 aaf30ee7 2021-08-29 stsp char *protocol;
26 aaf30ee7 2021-08-29 stsp int port;
27 aaf30ee7 2021-08-29 stsp struct node_branch *branch;
28 cfd92333 2021-08-27 tracey };
29 aaf30ee7 2021-08-29 stsp struct send_config {
30 aaf30ee7 2021-08-29 stsp char *repository;
31 aaf30ee7 2021-08-29 stsp char *server;
32 aaf30ee7 2021-08-29 stsp char *protocol;
33 aaf30ee7 2021-08-29 stsp int port;
34 aaf30ee7 2021-08-29 stsp struct node_branch *branch;
35 cfd92333 2021-08-27 tracey };
36 cfd92333 2021-08-27 tracey
37 b8adfa55 2020-09-25 stsp struct node_branch {
38 b8adfa55 2020-09-25 stsp char *branch_name;
39 b8adfa55 2020-09-25 stsp struct node_branch *next;
40 b8adfa55 2020-09-25 stsp struct node_branch *tail;
41 b8adfa55 2020-09-25 stsp };
42 b8adfa55 2020-09-25 stsp
43 99495ddb 2021-01-10 stsp struct node_ref {
44 99495ddb 2021-01-10 stsp char *ref_name;
45 99495ddb 2021-01-10 stsp struct node_ref *next;
46 99495ddb 2021-01-10 stsp struct node_ref *tail;
47 99495ddb 2021-01-10 stsp };
48 99495ddb 2021-01-10 stsp
49 257add31 2020-09-09 stsp struct gotconfig_remote_repo {
50 257add31 2020-09-09 stsp TAILQ_ENTRY(gotconfig_remote_repo) entry;
51 257add31 2020-09-09 stsp char *name;
52 257add31 2020-09-09 stsp char *repository;
53 257add31 2020-09-09 stsp char *server;
54 257add31 2020-09-09 stsp char *protocol;
55 257add31 2020-09-09 stsp int port;
56 257add31 2020-09-09 stsp int mirror_references;
57 0c8b29c5 2021-01-05 stsp int fetch_all_branches;
58 b8adfa55 2020-09-25 stsp struct node_branch *branch;
59 6480c871 2021-08-30 stsp struct node_ref *fetch_ref;
60 aaf30ee7 2021-08-29 stsp struct fetch_config *fetch_config;
61 aaf30ee7 2021-08-29 stsp struct send_config *send_config;
62 257add31 2020-09-09 stsp };
63 257add31 2020-09-09 stsp TAILQ_HEAD(gotconfig_remote_repo_list, gotconfig_remote_repo);
64 257add31 2020-09-09 stsp
65 257add31 2020-09-09 stsp struct gotconfig {
66 257add31 2020-09-09 stsp char *author;
67 257add31 2020-09-09 stsp struct gotconfig_remote_repo_list remotes;
68 257add31 2020-09-09 stsp int nremotes;
69 257add31 2020-09-09 stsp };
70 257add31 2020-09-09 stsp
71 257add31 2020-09-09 stsp /*
72 257add31 2020-09-09 stsp * Parse individual gotconfig repository files
73 257add31 2020-09-09 stsp */
74 257add31 2020-09-09 stsp const struct got_error *gotconfig_parse(struct gotconfig **, const char *,
75 257add31 2020-09-09 stsp int *);
76 257add31 2020-09-09 stsp void gotconfig_free(struct gotconfig *);