From: Junio C Hamano <gitster@pobox•com>
To: "brian m. carlson" <sandals@crustytoothpaste•net>
Cc: git@vger•kernel.org, Nicolas Vigier <boklm@mars-attacks•org>
Subject: Re: [PATCH v3 1/9] cherry-pick, revert: add the --gpg-sign option
Date: Mon, 03 Feb 2014 12:50:55 -0800 [thread overview]
Message-ID: <xmqq8utrex8w.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1391221086-1044384-2-git-send-email-sandals@crustytoothpaste.net> (brian m. carlson's message of "Sat, 1 Feb 2014 02:17:58 +0000")
"brian m. carlson" <sandals@crustytoothpaste•net> writes:
> diff --git a/sequencer.c b/sequencer.c
> index 90cac7b..bde5f04 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -392,11 +392,18 @@ 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);
Perhaps
argv_array_pushf(&array, "-S%s", opts->gpg_sign);
without any temporary? That would save 5 lines in total.
> + }
> if (opts->signoff)
> argv_array_push(&array, "-s");
> if (!opts->edit) {
diff --git a/sequencer.c b/sequencer.c
index bde5f04..b200dce 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -392,18 +392,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) {
next prev parent reply other threads:[~2014-02-03 20:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-01 2:17 [PATCH v3 0/9] add --gpg-sign to rebase and pull brian m. carlson
2014-02-01 2:17 ` [PATCH v3 1/9] cherry-pick, revert: add the --gpg-sign option brian m. carlson
2014-02-03 20:50 ` Junio C Hamano [this message]
2014-02-01 2:17 ` [PATCH v3 2/9] git-sh-setup.sh: add variable to use the stuck-long mode brian m. carlson
2014-02-01 2:18 ` [PATCH v3 3/9] am: parse options in " brian m. carlson
2014-02-01 2:18 ` [PATCH v3 4/9] am: add the --gpg-sign option brian m. carlson
2014-02-01 2:18 ` [PATCH v3 5/9] rebase: remove useless arguments check brian m. carlson
2014-02-01 2:18 ` [PATCH v3 6/9] rebase: don't try to match -M option brian m. carlson
2014-02-01 2:18 ` [PATCH v3 7/9] rebase: parse options in stuck-long mode brian m. carlson
2014-02-01 2:18 ` [PATCH v3 8/9] rebase: add the --gpg-sign option brian m. carlson
2014-02-03 21:42 ` Junio C Hamano
2014-02-07 23:50 ` brian m. carlson
2014-02-08 13:04 ` Philip Oakley
2014-02-01 2:18 ` [PATCH v3 9/9] pull: " brian m. carlson
2014-02-03 20:31 ` Junio C Hamano
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq8utrex8w.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=boklm@mars-attacks$(echo .)org \
--cc=git@vger$(echo .)kernel.org \
--cc=sandals@crustytoothpaste$(echo .)net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox