Blame


1 f8a36e22 2021-08-26 stsp /*
2 f8a36e22 2021-08-26 stsp * Copyright (c) 2018, 2019 Ori Bernstein <ori@openbsd.org>
3 f8a36e22 2021-08-26 stsp * Copyright (c) 2021 Stefan Sperling <stsp@openbsd.org>
4 f8a36e22 2021-08-26 stsp *
5 f8a36e22 2021-08-26 stsp * Permission to use, copy, modify, and distribute this software for any
6 f8a36e22 2021-08-26 stsp * purpose with or without fee is hereby granted, provided that the above
7 f8a36e22 2021-08-26 stsp * copyright notice and this permission notice appear in all copies.
8 f8a36e22 2021-08-26 stsp *
9 f8a36e22 2021-08-26 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 f8a36e22 2021-08-26 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 f8a36e22 2021-08-26 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 f8a36e22 2021-08-26 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 f8a36e22 2021-08-26 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 f8a36e22 2021-08-26 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 f8a36e22 2021-08-26 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 f8a36e22 2021-08-26 stsp */
17 f8a36e22 2021-08-26 stsp
18 f8a36e22 2021-08-26 stsp #define GOT_SEND_DEFAULT_REMOTE_NAME "origin"
19 f8a36e22 2021-08-26 stsp
20 f8a36e22 2021-08-26 stsp /*
21 f8a36e22 2021-08-26 stsp * Attempt to open a connection to a server using the provided protocol
22 f8a36e22 2021-08-26 stsp * scheme, hostname port number (as a string) and server-side path.
23 f8a36e22 2021-08-26 stsp * A verbosity level can be specified; it currently controls the amount
24 f8a36e22 2021-08-26 stsp * of -v options passed to ssh(1). If the level is -1 ssh(1) will be run
25 f8a36e22 2021-08-26 stsp * with the -q option.
26 f8a36e22 2021-08-26 stsp *
27 f8a36e22 2021-08-26 stsp * If successful return an open file descriptor for the connection which can
28 f8a36e22 2021-08-26 stsp * be passed to other functions below, and must be disposed of with close(2).
29 f8a36e22 2021-08-26 stsp *
30 f8a36e22 2021-08-26 stsp * If an ssh(1) process was started return its PID as well, in which case
31 f8a36e22 2021-08-26 stsp * the caller should eventually send SIGTERM to the procress and wait for
32 f8a36e22 2021-08-26 stsp * the process to exit with waitpid(2). Otherwise, return PID -1.
33 f8a36e22 2021-08-26 stsp */
34 f8a36e22 2021-08-26 stsp const struct got_error *got_send_connect(pid_t *, int *, const char *,
35 f8a36e22 2021-08-26 stsp const char *, const char *, const char *, int);
36 f8a36e22 2021-08-26 stsp
37 f8a36e22 2021-08-26 stsp /* A callback function which gets invoked with progress information to print. */
38 f8a36e22 2021-08-26 stsp typedef const struct got_error *(*got_send_progress_cb)(void *,
39 85220b0e 2022-03-22 thomas int ncolored, int nfound, int ntrees, off_t packfile_size, int ncommits,
40 85220b0e 2022-03-22 thomas int nobj_total, int nobj_deltify, int nobj_written, off_t bytes_sent,
41 f8a36e22 2021-08-26 stsp const char *refname, int success);
42 f8a36e22 2021-08-26 stsp
43 f8a36e22 2021-08-26 stsp /*
44 f8a36e22 2021-08-26 stsp * Attempt to generate a pack file and sent it to a server.
45 f8a36e22 2021-08-26 stsp * This pack file will contain objects which are reachable in the local
46 f8a36e22 2021-08-26 stsp * repository via the specified branches and tags. Any objects which are
47 f8a36e22 2021-08-26 stsp * already present in the remote repository will be omitted from the
48 f8a36e22 2021-08-26 stsp * pack file.
49 f8a36e22 2021-08-26 stsp *
50 f8a36e22 2021-08-26 stsp * If the server supports deletion of references, attempt to delete
51 f8a36e22 2021-08-26 stsp * branches on the specified delete_branches list from the server.
52 f8a36e22 2021-08-26 stsp * Such branches are not required to exist in the local repository.
53 f8a36e22 2021-08-26 stsp * Requesting deletion of branches results in an error if the server
54 f8a36e22 2021-08-26 stsp * does not support this feature.
55 f8a36e22 2021-08-26 stsp */
56 f8a36e22 2021-08-26 stsp const struct got_error *got_send_pack(const char *remote_name,
57 f8a36e22 2021-08-26 stsp struct got_pathlist_head *branch_names,
58 f8a36e22 2021-08-26 stsp struct got_pathlist_head *tag_names,
59 f8a36e22 2021-08-26 stsp struct got_pathlist_head *delete_branches, int verbosity,
60 f8a36e22 2021-08-26 stsp int overwrite_refs, int sendfd, struct got_repository *repo,
61 f8a36e22 2021-08-26 stsp got_send_progress_cb progress_cb, void *progress_arg,
62 f8a36e22 2021-08-26 stsp got_cancel_cb cancel_cb, void *cancel_arg);