From: "René Scharfe" <l.s.r@web.de>
To: Git Mailing List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>,
Jens Lehmann <Jens.Lehmann@web.de>,
Matthieu Moy <Matthieu.Moy@imag.fr>
Subject: [PATCH 2/2] wt-status: simplify building of summary limit argument
Date: Sun, 29 Jun 2014 22:55:44 +0200 [thread overview]
Message-ID: <53B07D50.9050805@web.de> (raw)
In-Reply-To: <53B07B44.9000406@web.de>
Use argv_array_pushf for building the number string for the option
--summary-limit directly instead of using an intermediate buffer.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
wt-status.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/wt-status.c b/wt-status.c
index 2c0bff8..882cfe9 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -734,7 +734,6 @@ static void wt_status_print_changed(struct wt_status *s)
static void wt_status_print_submodule_summary(struct wt_status *s, int uncommitted)
{
struct child_process sm_summary;
- char summary_limit[64];
struct argv_array env = ARGV_ARRAY_INIT;
struct argv_array argv = ARGV_ARRAY_INIT;
struct strbuf cmd_stdout = STRBUF_INIT;
@@ -742,7 +741,6 @@ static void wt_status_print_submodule_summary(struct wt_status *s, int uncommitt
char *summary_content;
size_t len;
- sprintf(summary_limit, "%d", s->submodule_summary);
argv_array_pushf(&env, "GIT_INDEX_FILE=%s", s->index_file);
argv_array_push(&argv, "submodule");
@@ -750,7 +748,7 @@ static void wt_status_print_submodule_summary(struct wt_status *s, int uncommitt
argv_array_push(&argv, uncommitted ? "--files" : "--cached");
argv_array_push(&argv, "--for-status");
argv_array_push(&argv, "--summary-limit");
- argv_array_push(&argv, summary_limit);
+ argv_array_pushf(&argv, "%d", s->submodule_summary);
if (!uncommitted)
argv_array_push(&argv, s->amend ? "HEAD^" : "HEAD");
--
2.0.0
next prev parent reply other threads:[~2014-06-29 20:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-29 20:47 [PATCH 1/2] wt-status: use argv_array for environment René Scharfe
2014-06-29 20:55 ` René Scharfe [this message]
2014-07-01 8:44 ` [PATCH 2/2] wt-status: simplify building of summary limit argument Matthieu Moy
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=53B07D50.9050805@web.de \
--to=l.s.r@web.de \
--cc=Jens.Lehmann@web.de \
--cc=Matthieu.Moy@imag.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.