summaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2013-07-21 08:18:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-07-23 19:18:18 (GMT)
commit9ba380481cc3a5ae7706763d71cf8844917ed804 (patch)
tree44a1f26052d15dfc349e0edc34df0117cb0595e7 /transport-helper.c
parentc6807a40dcd29f7e5ad1e2f4fc44f1729c9afa11 (diff)
downloadgit-9ba380481cc3a5ae7706763d71cf8844917ed804.zip
git-9ba380481cc3a5ae7706763d71cf8844917ed804.tar.gz
git-9ba380481cc3a5ae7706763d71cf8844917ed804.tar.bz2
smart http: use the same connectivity check on cloning
This is an extension of c6807a4 (clone: open a shortcut for connectivity check - 2013-05-26) to reduce the cost of connectivity check at clone time, this time with smart http protocol. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/transport-helper.c b/transport-helper.c
index 522d791..fe1b702 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -26,6 +26,7 @@ struct helper_data {
push : 1,
connect : 1,
signed_tags : 1,
+ check_connectivity : 1,
no_disconnect_req : 1;
char *export_marks;
char *import_marks;
@@ -185,6 +186,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,
@@ -346,6 +349,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];
@@ -369,6 +375,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