| 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 | dry_run:1, |
| 32 | /* One of the SEND_PACK_PUSH_CERT_* constants. */ |
| 33 | push_cert:2, |
| 34 | stateless_rpc:1, |
| 35 | atomic:1, |
| 36 | disable_bitmaps:1; |
| 37 | const struct string_list *push_options; |
| 38 | }; |
| 39 | |
| 40 | struct option; |
| 41 | int option_parse_push_signed(const struct option *opt, |
| 42 | const char *arg, int unset); |
| 43 | |
| 44 | /* |
| 45 | * Compute a packfile and write it to a file descriptor. The `fd` array needs |
| 46 | * to contain two file descriptors: `fd[0]` is the file descriptor used as |
| 47 | * input for the packet reader, whereas `fd[1]` is the file descriptor the |
| 48 | * packfile will be written to. |
| 49 | * |
| 50 | * Returns 0 on success, non-zero otherwise. Negative return values indicate a |
| 51 | * generic error, whereas positive return values indicate specific error |
| 52 | * conditions as documented with the `ERROR_SEND_PACK_*` constants. |
| 53 | */ |
| 54 | int send_pack(struct repository *r, struct send_pack_args *args, |
| 55 | int fd[], struct child_process *conn, |
| 56 | struct ref *remote_refs, struct oid_array *extra_have); |
| 57 | |
| 58 | #endif |