git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ping Yin <pkufranky@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Ping Yin <pkufranky@gmail.com>
Subject: [PATCH v2 3/4] builtin-status: configurable submodule summary size
Date: Thu, 13 Mar 2008 21:48:04 +0800	[thread overview]
Message-ID: <1205416085-23431-4-git-send-email-pkufranky@gmail.com> (raw)
In-Reply-To: <1205416085-23431-3-git-send-email-pkufranky@gmail.com>

Add config variable status.submodulesummary which is passed as
arg for '--summary-limit' of 'git submodule summary' to limit the
submodule summary size.

status.submodulesummary is 0 by default which disables the summary.

Signed-off-by: Ping Yin <pkufranky@gmail.com>
---
 wt-status.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/wt-status.c b/wt-status.c
index 75ee7ba..2f47e36 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -12,6 +12,7 @@
 
 int wt_status_relative_paths = 1;
 int wt_status_use_color = -1;
+int wt_status_submodule_summary = 0;
 static char wt_status_colors[][COLOR_MAXLEN] = {
 	"",         /* WT_STATUS_HEADER: normal */
 	"\033[32m", /* WT_STATUS_UPDATED: green */
@@ -222,12 +223,17 @@ static void wt_status_print_changed(struct wt_status *s)
 }
 static void wt_status_print_submodule_summary(struct wt_status *s)
 {
+	if (wt_status_submodule_summary == 0) return;
 	struct child_process sm_summary;
+	char summary_limit[64];
+	sprintf(summary_limit, "%d", wt_status_submodule_summary);
 	const char *argv[] = {
 		"submodule",
 		"summary",
 		"--cached",
 		"--for-status",
+		"--summary-limit",
+		summary_limit,
 		s->amend ? "HEAD^" : "HEAD",
 		NULL
 	};
@@ -371,6 +377,10 @@ void wt_status_print(struct wt_status *s)
 
 int git_status_config(const char *k, const char *v)
 {
+	if (!strcmp(k, "status.submodulesummary")) {
+		wt_status_submodule_summary = atoi(v);
+		return 0;
+	}
 	if (!strcmp(k, "status.color") || !strcmp(k, "color.status")) {
 		wt_status_use_color = git_config_colorbool(k, v, -1);
 		return 0;
-- 
1.5.4.3.347.g5314c

  reply	other threads:[~2008-03-13 13:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-13 13:48 builtin-status submodule summary Ping Yin
2008-03-13 13:48 ` [PATCH v2 1/4] git-submodule summary: --for-status option Ping Yin
2008-03-13 13:48   ` [PATCH v2 2/4] builtin-status: submodule summary support Ping Yin
2008-03-13 13:48     ` Ping Yin [this message]
2008-03-13 13:48       ` [PATCH v2 4/4] buitin-status: Add tests for submodule summary Ping Yin
2008-03-13 14:21         ` Johannes Sixt
2008-03-13 18:04           ` Junio C Hamano
2008-03-13 18:14             ` Ping Yin
2008-03-13 18:09           ` Ping Yin
2008-03-13 14:15       ` [PATCH v2 3/4] builtin-status: configurable submodule summary size Johannes Sixt
2008-03-13 14:11     ` [PATCH v2 2/4] builtin-status: submodule summary support Johannes Sixt
2008-03-13 18:01       ` Ping Yin
2008-03-14 14:30 ` builtin-status submodule summary Ping Yin
2008-03-14 16:39   ` Junio C Hamano
2008-03-14 17:45     ` Ping Yin

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=1205416085-23431-4-git-send-email-pkufranky@gmail.com \
    --to=pkufranky@gmail.com \
    --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 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 NNTP newsgroup(s).