summaryrefslogtreecommitdiff
path: root/transport.c
diff options
context:
space:
mode:
Diffstat (limited to 'transport.c')
-rw-r--r--transport.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/transport.c b/transport.c
index ef66e73090..6cf3da19eb 100644
--- a/transport.c
+++ b/transport.c
@@ -108,11 +108,11 @@ static void set_upstreams(struct transport *transport, struct ref *refs,
if (!remotename || !starts_with(remotename, "refs/heads/"))
continue;
- if (!pretend)
- install_branch_config(BRANCH_CONFIG_VERBOSE,
- localname + 11, transport->remote->name,
- remotename);
- else
+ if (!pretend) {
+ int flag = transport->verbose < 0 ? 0 : BRANCH_CONFIG_VERBOSE;
+ install_branch_config(flag, localname + 11,
+ transport->remote->name, remotename);
+ } else if (transport->verbose >= 0)
printf(_("Would set upstream of '%s' to '%s' of '%s'\n"),
localname + 11, remotename + 11,
transport->remote->name);
@@ -392,16 +392,29 @@ static int fetch_refs_via_pack(struct transport *transport,
else if (data->version <= protocol_v1)
die_if_server_options(transport);
+ if (data->options.acked_commits) {
+ if (data->version < protocol_v2) {
+ warning(_("--negotiate-only requires protocol v2"));
+ ret = -1;
+ } else if (!server_supports_feature("fetch", "wait-for-done", 0)) {
+ warning(_("server does not support wait-for-done"));
+ ret = -1;
+ } else {
+ negotiate_using_fetch(data->options.negotiation_tips,
+ transport->server_options,
+ transport->stateless_rpc,
+ data->fd,
+ data->options.acked_commits);
+ ret = 0;
+ }
+ goto cleanup;
+ }
+
refs = fetch_pack(&args, data->fd,
refs_tmp ? refs_tmp : transport->remote_refs,
to_fetch, nr_heads, &data->shallow,
&transport->pack_lockfiles, data->version);
- close(data->fd[0]);
- close(data->fd[1]);
- if (finish_connect(data->conn))
- ret = -1;
- data->conn = NULL;
data->got_remote_heads = 0;
data->options.self_contained_and_connected =
args.self_contained_and_connected;
@@ -412,6 +425,13 @@ static int fetch_refs_via_pack(struct transport *transport,
if (report_unmatched_refs(to_fetch, nr_heads))
ret = -1;
+cleanup:
+ close(data->fd[0]);
+ close(data->fd[1]);
+ if (finish_connect(data->conn))
+ ret = -1;
+ data->conn = NULL;
+
free_refs(refs_tmp);
free_refs(refs);
return ret;