diff options
Diffstat (limited to 'transport.h')
-rw-r--r-- | transport.h | 67 |
1 files changed, 62 insertions, 5 deletions
diff --git a/transport.h b/transport.h index 059b3303e2..4336dd33eb 100644 --- a/transport.h +++ b/transport.h @@ -2,15 +2,20 @@ #define TRANSPORT_H #include "cache.h" +#include "run-command.h" #include "remote.h" struct git_transport_options { unsigned thin : 1; unsigned keep : 1; unsigned followtags : 1; + unsigned check_self_contained_and_connected : 1; + unsigned self_contained_and_connected : 1; + unsigned update_shallow : 1; int depth; const char *uploadpack; const char *receivepack; + struct push_cas_option *cas; }; struct transport { @@ -25,6 +30,18 @@ struct transport { */ unsigned got_remote_refs : 1; + /* + * Transports that call take-over destroys the data specific to + * the transport type while doing so, and cannot be reused. + */ + unsigned cannot_reuse : 1; + + /* + * A hint from caller that it will be performing a clone, not + * normal fetch. IOW the repository is guaranteed empty. + */ + unsigned cloning : 1; + /** * Returns 0 if successful, positive if the option is not * recognized or is inapplicable, and negative if the option @@ -74,7 +91,7 @@ struct transport { const char *executable, int fd[2]); /** get_refs_list(), fetch(), and push_refs() can keep - * resources (such as a connection) reserved for futher + * resources (such as a connection) reserved for further * use. disconnect() releases these resources. **/ int (*disconnect)(struct transport *connection); @@ -102,12 +119,38 @@ struct transport { #define TRANSPORT_PUSH_PORCELAIN 16 #define TRANSPORT_PUSH_SET_UPSTREAM 32 #define TRANSPORT_RECURSE_SUBMODULES_CHECK 64 +#define TRANSPORT_PUSH_PRUNE 128 +#define TRANSPORT_RECURSE_SUBMODULES_ON_DEMAND 256 +#define TRANSPORT_PUSH_NO_HOOK 512 +#define TRANSPORT_PUSH_FOLLOW_TAGS 1024 +#define TRANSPORT_PUSH_CERT_ALWAYS 2048 +#define TRANSPORT_PUSH_CERT_IF_ASKED 4096 +#define TRANSPORT_PUSH_ATOMIC 8192 #define TRANSPORT_SUMMARY_WIDTH (2 * DEFAULT_ABBREV + 3) +#define TRANSPORT_SUMMARY(x) (int)(TRANSPORT_SUMMARY_WIDTH + strlen(x) - gettext_width(x)), (x) /* Returns a transport suitable for the url */ struct transport *transport_get(struct remote *, const char *); +/* + * Check whether a transport is allowed by the environment. Type should + * generally be the URL scheme, as described in Documentation/git.txt + */ +int is_transport_allowed(const char *type); + +/* + * Check whether a transport is allowed by the environment, + * and die otherwise. + */ +void transport_check_allowed(const char *type); + +/* + * Returns true if the user has attempted to turn on protocol + * restrictions at all. + */ +int transport_restrict_protocols(void); + /* Transport options which apply to git:// and scp-style URLs */ /* The program to use on the remote side to send a pack */ @@ -119,6 +162,9 @@ struct transport *transport_get(struct remote *, const char *); /* Transfer the data as a thin pack if not null */ #define TRANS_OPT_THIN "thin" +/* Check the current value of the remote ref */ +#define TRANS_OPT_CAS "cas" + /* Keep the pack that was transferred if not null */ #define TRANS_OPT_KEEP "keep" @@ -128,6 +174,12 @@ struct transport *transport_get(struct remote *, const char *); /* Aggressively fetch annotated tags if possible */ #define TRANS_OPT_FOLLOWTAGS "followtags" +/* Accept refs that may update .git/shallow without --depth */ +#define TRANS_OPT_UPDATE_SHALLOW "updateshallow" + +/* Send push certificates */ +#define TRANS_OPT_PUSH_CERT "pushcert" + /** * Returns 0 if the option was used, non-zero otherwise. Prints a * message to stderr if the option is not used. @@ -137,9 +189,15 @@ int transport_set_option(struct transport *transport, const char *name, void transport_set_verbosity(struct transport *transport, int verbosity, int force_progress); +#define REJECT_NON_FF_HEAD 0x01 +#define REJECT_NON_FF_OTHER 0x02 +#define REJECT_ALREADY_EXISTS 0x04 +#define REJECT_FETCH_FIRST 0x08 +#define REJECT_NEEDS_FORCE 0x10 + int transport_push(struct transport *connection, int refspec_nr, const char **refspec, int flags, - int * nonfastforward); + unsigned int * reject_reasons); const struct ref *transport_get_remote_refs(struct transport *transport); @@ -157,7 +215,7 @@ int transport_connect(struct transport *transport, const char *name, int transport_helper_init(struct transport *transport, const char *name); int bidirectional_transfer_loop(int input, int output); -/* common methods used by transport.c and builtin-send-pack.c */ +/* common methods used by transport.c and builtin/send-pack.c */ void transport_verify_remote_names(int nr_heads, const char **heads); void transport_update_tracking_ref(struct remote *remote, struct ref *ref, int verbose); @@ -165,9 +223,8 @@ void transport_update_tracking_ref(struct remote *remote, struct ref *ref, int v int transport_refs_pushed(struct ref *ref); void transport_print_push_status(const char *dest, struct ref *refs, - int verbose, int porcelain, int *nonfastforward); + int verbose, int porcelain, unsigned int *reject_reasons); typedef void alternate_ref_fn(const struct ref *, void *); extern void for_each_alternate_ref(alternate_ref_fn, void *); - #endif |