Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
sequencer: use argv_array_pushf
author
Jeff King
<peff@peff.net>
Thu, 19 Jun 2014 21:28:20 +0000
(17:28 -0400)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 19 Jun 2014 22:20:55 +0000
(15:20 -0700)
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>
sequencer.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
a0279e1
)
diff --git
a/sequencer.c
b/sequencer.c
index 0a80c58d1194c3476dfd2861a98fbd08610597a3..2fea8243491b5dcabf525ef70c6205aba0e943f5 100644
(file)
--- a/
sequencer.c
+++ b/
sequencer.c
@@
-396,18
+396,13
@@
static int run_git_commit(const char *defmsg, struct replay_opts *opts,
{
struct argv_array array;
int rc;
{
struct argv_array array;
int rc;
- char *gpg_sign;
argv_array_init(&array);
argv_array_push(&array, "commit");
argv_array_push(&array, "-n");
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) {
if (opts->signoff)
argv_array_push(&array, "-s");
if (!opts->edit) {