2 * Copyright (c) 2018, 2019 Ori Bernstein <ori@openbsd.org>
3 * Copyright (c) 2021 Stefan Sperling <stsp@openbsd.org>
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.
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.
18 #define GOT_SEND_DEFAULT_REMOTE_NAME "origin"
21 * Attempt to open a connection to a server using the provided protocol
22 * scheme, hostname port number (as a string) and server-side path.
23 * A verbosity level can be specified; it currently controls the amount
24 * of -v options passed to ssh(1). If the level is -1 ssh(1) will be run
27 * If successful return an open file descriptor for the connection which can
28 * be passed to other functions below, and must be disposed of with close(2).
30 * If an ssh(1) process was started return its PID as well, in which case
31 * the caller should eventually send SIGTERM to the procress and wait for
32 * the process to exit with waitpid(2). Otherwise, return PID -1.
34 const struct got_error
*got_send_connect(pid_t
*, int *, const char *,
35 const char *, const char *, const char *, int);
37 /* A callback function which gets invoked with progress information to print. */
38 typedef const struct got_error
*(*got_send_progress_cb
)(void *,
39 int ncolored
, int nfound
, int ntrees
, off_t packfile_size
, int ncommits
,
40 int nobj_total
, int nobj_deltify
, int nobj_written
, off_t bytes_sent
,
41 const char *refname
, const char *, int success
);
44 * Attempt to generate a pack file and sent it to a server.
45 * This pack file will contain objects which are reachable in the local
46 * repository via the specified branches and tags. Any objects which are
47 * already present in the remote repository will be omitted from the
50 * If the server supports deletion of references, attempt to delete
51 * branches on the specified delete_branches list from the server.
52 * Such branches are not required to exist in the local repository.
53 * Requesting deletion of branches results in an error if the server
54 * does not support this feature.
56 const struct got_error
*got_send_pack(const char *remote_name
,
57 struct got_pathlist_head
*branch_names
,
58 struct got_pathlist_head
*tag_names
,
59 struct got_pathlist_head
*delete_branches
, int verbosity
,
60 int overwrite_refs
, int sendfd
, struct got_repository
*repo
,
61 got_send_progress_cb progress_cb
, void *progress_arg
,
62 got_cancel_cb cancel_cb
, void *cancel_arg
);