diff options
Diffstat (limited to 'transport-helper.c')
-rw-r--r-- | transport-helper.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/transport-helper.c b/transport-helper.c index e3a60d777d..4c2a39e8ff 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -27,6 +27,7 @@ struct helper_data { push : 1, connect : 1, signed_tags : 1, + check_connectivity : 1, no_disconnect_req : 1; char *export_marks; char *import_marks; @@ -186,6 +187,8 @@ static struct child_process *get_helper(struct transport *transport) data->bidi_import = 1; else if (!strcmp(capname, "export")) data->export = 1; + else if (!strcmp(capname, "check-connectivity")) + data->check_connectivity = 1; else if (!data->refspecs && !prefixcmp(capname, "refspec ")) { ALLOC_GROW(refspecs, refspec_nr + 1, @@ -349,6 +352,9 @@ static int fetch_with_fetch(struct transport *transport, struct strbuf buf = STRBUF_INIT; standard_options(transport); + if (data->check_connectivity && + data->transport_options.check_self_contained_and_connected) + set_helper_option(transport, "check-connectivity", "true"); for (i = 0; i < nr_heads; i++) { const struct ref *posn = to_fetch[i]; @@ -372,6 +378,10 @@ static int fetch_with_fetch(struct transport *transport, else transport->pack_lockfile = xstrdup(name); } + else if (data->check_connectivity && + data->transport_options.check_self_contained_and_connected && + !strcmp(buf.buf, "connectivity-ok")) + data->transport_options.self_contained_and_connected = 1; else if (!buf.len) break; else @@ -1008,6 +1018,7 @@ int transport_helper_init(struct transport *transport, const char *name) #define PBUFFERSIZE 8192 /* Print bidirectional transfer loop debug message. */ +__attribute__((format (printf, 1, 2))) static void transfer_debug(const char *fmt, ...) { va_list args; @@ -1093,7 +1104,7 @@ static int udt_do_read(struct unidirectional_transfer *t) return -1; } else if (bytes == 0) { transfer_debug("%s EOF (with %i bytes in buffer)", - t->src_name, t->bufuse); + t->src_name, (int)t->bufuse); t->state = SSTATE_FLUSHING; } else if (bytes > 0) { t->bufuse += bytes; @@ -1157,7 +1168,7 @@ static void *udt_copy_task_routine(void *udt) #ifndef NO_PTHREADS /* - * Join thread, with apporiate errors on failure. Name is name for the + * Join thread, with appropriate errors on failure. Name is name for the * thread (for error messages). Returns 0 on success, 1 on failure. */ static int tloop_join(pthread_t thread, const char *name) @@ -1223,7 +1234,7 @@ static void udt_kill_transfer(struct unidirectional_transfer *t) } /* - * Join process, with apporiate errors on failure. Name is name for the + * Join process, with appropriate errors on failure. Name is name for the * process (for error messages). Returns 0 on success, 1 on failure. */ static int tloop_join(pid_t pid, const char *name) |