Raw
1 #ifndef SEND_PACK_H
2 #define SEND_PACK_H
3
4 #include "string-list.h"
5
6 struct child_process;
7 struct oid_array;
8 struct ref;
9 struct repository;
10
11 /* Possible values for push_cert field in send_pack_args. */
12 #define SEND_PACK_PUSH_CERT_NEVER 0
13 #define SEND_PACK_PUSH_CERT_IF_ASKED 1
14 #define SEND_PACK_PUSH_CERT_ALWAYS 2
15
16 /* At least one reference has been rejected by the remote side. */
17 #define ERROR_SEND_PACK_BAD_REF_STATUS 1
18
19 struct send_pack_args {
20 const char *url;
21 const struct string_list *negotiation_include;
22 const struct string_list *negotiation_restrict;
23 unsigned verbose:1,
24 quiet:1,
25 porcelain:1,
26 progress:1,
27 send_mirror:1,
28 force_update:1,
29 use_thin_pack:1,
30 use_ofs_delta:1,
31 no_ref_delta:1,
32 dry_run:1,
33 /* One of the SEND_PACK_PUSH_CERT_* constants. */
34 push_cert:2,
35 stateless_rpc:1,
36 atomic:1,
37 disable_bitmaps:1;
38 const struct string_list *push_options;
39 };
40
41 struct option;
42 int option_parse_push_signed(const struct option *opt,
43 const char *arg, int unset);
44
45 /*
46 * Compute a packfile and write it to a file descriptor. The `fd` array needs
47 * to contain two file descriptors: `fd[0]` is the file descriptor used as
48 * input for the packet reader, whereas `fd[1]` is the file descriptor the
49 * packfile will be written to.
50 *
51 * Returns 0 on success, non-zero otherwise. Negative return values indicate a
52 * generic error, whereas positive return values indicate specific error
53 * conditions as documented with the `ERROR_SEND_PACK_*` constants.
54 */
55 int send_pack(struct repository *r, struct send_pack_args *args,
56 int fd[], struct child_process *conn,
57 struct ref *remote_refs, struct oid_array *extra_have);
58
59 #endif