Blob


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