Browse Source

sequencer: use argv_array_pushf

This avoids a manual allocation calculation, and is shorter
to boot.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Jeff King 11 years ago committed by Junio C Hamano
parent
commit
3bdd55228b
  1. 9
      sequencer.c

9
sequencer.c

@ -396,18 +396,13 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts, @@ -396,18 +396,13 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,
{
struct argv_array array;
int rc;
char *gpg_sign;

argv_array_init(&array);
argv_array_push(&array, "commit");
argv_array_push(&array, "-n");

if (opts->gpg_sign) {
gpg_sign = xmalloc(3 + strlen(opts->gpg_sign));
sprintf(gpg_sign, "-S%s", opts->gpg_sign);
argv_array_push(&array, gpg_sign);
free(gpg_sign);
}
if (opts->gpg_sign)
argv_array_pushf(&array, "-S%s", opts->gpg_sign);
if (opts->signoff)
argv_array_push(&array, "-s");
if (!opts->edit) {

Loading…
Cancel
Save