get_importer: use run-command's internal argv_array

This saves a few lines and lets us avoid having to clean up the memory manually when the command finishes. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed May 15, 2014 at 04:35 UTC 173fd1a1a44b89a204eb1289e4ff1f9d733e0cf1
1 file changed +3 -6
transport-helper.c
+3 -6
@@ -394,18 +394,16 @@ static int get_importer(struct transport *transport, struct child_process *fasti
394 {
395 struct child_process *helper = get_helper(transport);
396 struct helper_data *data = transport->data;
397 - struct argv_array argv = ARGV_ARRAY_INIT;
397 int cat_blob_fd, code;
398 memset(fastimport, 0, sizeof(*fastimport));
399 fastimport->in = helper->out;
401 - argv_array_push(&argv, "fast-import");
402 - argv_array_push(&argv, debug ? "--stats" : "--quiet");
400 + argv_array_push(&fastimport->args, "fast-import");
401 + argv_array_push(&fastimport->args, debug ? "--stats" : "--quiet");
402
403 if (data->bidi_import) {
404 cat_blob_fd = xdup(helper->in);
406 - argv_array_pushf(&argv, "--cat-blob-fd=%d", cat_blob_fd);
405 + argv_array_pushf(&fastimport->args, "--cat-blob-fd=%d", cat_blob_fd);
406 }
408 - fastimport->argv = argv.argv;
407 fastimport->git_cmd = 1;
408
409 code = start_command(fastimport);
@@ -476,7 +474,6 @@ static int fetch_with_import(struct transport *transport,
474
475 if (finish_command(&fastimport))
476 die("Error while running fast-import");
479 - argv_array_free_detached(fastimport.argv);
477
478 /*
479 * The fast-import stream of a remote helper that advertises