Skip to content

Commit

Permalink
Merge branch 'jc/remote-http-argv-array'
Browse files Browse the repository at this point in the history
* jc/remote-http-argv-array:
  remote-http: use argv-array
  • Loading branch information
Junio C Hamano committed Jul 12, 2013
2 parents d5a3897 + 222b121 commit fb1c85d
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions remote-curl.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "run-command.h"
#include "pkt-line.h"
#include "sideband.h"
#include "argv-array.h"

static struct remote *remote;
static const char *url; /* always ends with a trailing slash */
Expand Down Expand Up @@ -787,36 +788,35 @@ static int push_dav(int nr_spec, char **specs)
static int push_git(struct discovery *heads, int nr_spec, char **specs)
{
struct rpc_state rpc;
const char **argv;
int argc = 0, i, err;
int i, err;
struct argv_array args;

argv_array_init(&args);
argv_array_pushl(&args, "send-pack", "--stateless-rpc", "--helper-status",
NULL);

argv = xmalloc((10 + nr_spec) * sizeof(char*));
argv[argc++] = "send-pack";
argv[argc++] = "--stateless-rpc";
argv[argc++] = "--helper-status";
if (options.thin)
argv[argc++] = "--thin";
argv_array_push(&args, "--thin");
if (options.dry_run)
argv[argc++] = "--dry-run";
argv_array_push(&args, "--dry-run");
if (options.verbosity == 0)
argv[argc++] = "--quiet";
argv_array_push(&args, "--quiet");
else if (options.verbosity > 1)
argv[argc++] = "--verbose";
argv[argc++] = options.progress ? "--progress" : "--no-progress";
argv[argc++] = url;
argv_array_push(&args, "--verbose");
argv_array_push(&args, options.progress ? "--progress" : "--no-progress");
argv_array_push(&args, url);
for (i = 0; i < nr_spec; i++)
argv[argc++] = specs[i];
argv[argc++] = NULL;
argv_array_push(&args, specs[i]);

memset(&rpc, 0, sizeof(rpc));
rpc.service_name = "git-receive-pack",
rpc.argv = argv;
rpc.argv = args.argv;

err = rpc_service(&rpc, heads);
if (rpc.result.len)
write_or_die(1, rpc.result.buf, rpc.result.len);
strbuf_release(&rpc.result);
free(argv);
argv_array_clear(&args);
return err;
}

Expand Down

0 comments on commit fb1c85d

Please sign in to comment.