git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] http: use internal argv_array of struct child_process
Date: Fri, 22 Dec 2017 03:59:52 -0500	[thread overview]
Message-ID: <CAPig+cQaQ9ae1e4eMfJMG4wykXe2tTgtvpxB1_Z=3XbitYeQyw@mail.gmail.com> (raw)
In-Reply-To: <504cafe3-2960-af2d-10fe-51e8ba3d2213@web.de>

On Fri, Dec 22, 2017 at 3:14 AM, René Scharfe <l.s.r@web.de> wrote:
> Avoid a strangely magic array size (it's slightly too big) and explicit
> index numbers by building the command line for index-pack using the
> embedded argv_array of the child_process.  The resulting code is shorter
> and easier to extend.
>
> Signed-off-by: Rene Scharfe <l.s.r@web.de>
> ---
> diff --git a/http.c b/http.c
> @@ -2041,13 +2040,10 @@ int finish_http_pack_request(struct http_pack_request *preq)
> -       ip_argv[0] = "index-pack";
> -       ip_argv[1] = "-o";
> -       ip_argv[2] = tmp_idx;
> -       ip_argv[3] = preq->tmpfile;
> -       ip_argv[4] = NULL;
> -
> -       ip.argv = ip_argv;
> +       argv_array_push(&ip.args, "index-pack");
> +       argv_array_push(&ip.args, "-o");
> +       argv_array_push(&ip.args, tmp_idx);
> +       argv_array_push(&ip.args, preq->tmpfile);

Not necessarily worth a re-roll, but using the "pushl" variant would
make it clear that "-o" and tmp_idx are related and would ensure that
they don't accidentally get split up if someone inserts a new "push"
in the sequence in the future.

    argv_array_push(&ip.args, "index-pack");
    argv_array_pushl(&ip.args, "-o", tmp_idx, NULL);
    argv_array_push(&ip.args, preq->tmpfile);

  reply	other threads:[~2017-12-22  9:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22  8:14 [PATCH] http: use internal argv_array of struct child_process René Scharfe
2017-12-22  8:59 ` Eric Sunshine [this message]
2017-12-22 11:56   ` [PATCH v2] " René Scharfe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPig+cQaQ9ae1e4eMfJMG4wykXe2tTgtvpxB1_Z=3XbitYeQyw@mail.gmail.com' \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=l.s.r@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).