push: teach --force-with-lease to smart-http transport

We have been passing enough information to enable the
compare-and-swap logic down to the transport layer, but the
transport helper was not passing it to smart-http transport.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano
2013-08-02 15:14:50 -07:00
parent 77aa93481d
commit 05c1eb1034
4 changed files with 40 additions and 5 deletions

View File

@ -6,6 +6,7 @@
#include "exec_cmd.h"
#include "run-command.h"
#include "pkt-line.h"
#include "string-list.h"
#include "sideband.h"
static struct remote *remote;
@ -20,6 +21,7 @@ struct options {
thin : 1;
};
static struct options options;
static struct string_list cas_options = STRING_LIST_INIT_DUP;
static int set_option(const char *name, const char *value)
{
@ -66,6 +68,13 @@ static int set_option(const char *name, const char *value)
return -1;
return 0;
}
else if (!strcmp(name, "cas")) {
struct strbuf val = STRBUF_INIT;
strbuf_addf(&val, "--" CAS_OPT_NAME "=%s", value);
string_list_append(&cas_options, val.buf);
strbuf_release(&val);
return 0;
}
else {
return 1 /* unsupported */;
}
@ -789,8 +798,9 @@ static int push_git(struct discovery *heads, int nr_spec, char **specs)
struct rpc_state rpc;
const char **argv;
int argc = 0, i, err;
struct string_list_item *cas_option;
argv = xmalloc((10 + nr_spec) * sizeof(char*));
argv = xmalloc((10 + nr_spec + cas_options.nr) * sizeof(char *));
argv[argc++] = "send-pack";
argv[argc++] = "--stateless-rpc";
argv[argc++] = "--helper-status";
@ -803,6 +813,10 @@ static int push_git(struct discovery *heads, int nr_spec, char **specs)
else if (options.verbosity > 1)
argv[argc++] = "--verbose";
argv[argc++] = options.progress ? "--progress" : "--no-progress";
for_each_string_list_item(cas_option, &cas_options)
argv[argc++] = cas_option->string;
argv[argc++] = url;
for (i = 0; i < nr_spec; i++)
argv[argc++] = specs[i];