summaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
authorDavid Turner <dturner@twopensource.com>2016-04-15 15:19:09 -0400
committerJunio C Hamano <gitster@pobox.com>2016-04-18 11:46:05 -0700
commit771dcaaee911d3cf2460a750e60ce611950d027e (patch)
treefda7ebbe114974f5bb0a114fa239219642d112c4 /transport-helper.c
parentfa16ec8aaa3247e8bd271b1728f6b59df1649194 (diff)
downloadgit-dt/http-fetch-limit-advertisement.tar.gz
clone: send refspec for single-branch clonesdt/http-fetch-limit-advertisement
For single-branch clones (when we know in advance what the remote branch name will be), send a refspec so that the server doesn't tell us about any other refs. Signed-off-by: David Turner <dturner@twopensource.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/transport-helper.c b/transport-helper.c
index 7d75d64744..3775d63aff 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -28,6 +28,7 @@ struct helper_data {
signed_tags : 1,
check_connectivity : 1,
no_disconnect_req : 1,
+ refspec : 1,
no_private_update : 1;
char *export_marks;
char *import_marks;
@@ -114,8 +115,15 @@ static struct child_process *get_helper(struct transport *transport, const struc
int code;
int i;
- if (data->helper)
+ if (data->helper) {
+ if (!data->refspec && req_refspec_nr) {
+ for (i = 0; i < req_refspec_nr; i++)
+ set_helper_option(transport, "refspec",
+ req_refspecs[i].src);
+ data->refspec = 1;
+ }
return data->helper;
+ }
helper = xmalloc(sizeof(*helper));
child_process_init(helper);
@@ -220,6 +228,8 @@ static struct child_process *get_helper(struct transport *transport, const struc
for (i = 0; i < req_refspec_nr; i++)
set_helper_option(transport, "refspec", req_refspecs[i].src);
+ if (req_refspec_nr)
+ data->refspec = 1;
standard_options(transport);
return data->helper;
}