git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 5/5] merge: support setting merge.[diff]stat to dynstat

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Jan 16, 2012, 04:48 UTC
Message-ID
<1326689281-23788-6-git-send-email-pclouds@gmail.com>
In-Reply-To
<1326689281-23788-1-git-send-email-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/merge.c |   30 +++++++++++++++++++++++++-----
 1 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/builtin/merge.c b/builtin/merge.c
index 3a45172..b8280ce 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -46,7 +46,13 @@ static const char * const builtin_merge_usage[] = {
 	NULL
 };
 
-static int show_diffstat = 1, shortlog_len = -1, squash;
+enum show_diffstat {
+	NO_STAT,
+	DIFF_STAT,
+	DYNAMIC_STAT
+};
+
+static int show_diffstat = NO_STAT, shortlog_len = -1, squash;
 static int option_commit = 1, allow_fast_forward = 1;
 static int fast_forward_only, option_edit;
 static int allow_trivial = 1, have_message;
@@ -399,8 +405,15 @@ static void finish(struct commit *head_commit,
 	if (new_head && show_diffstat) {
 		struct diff_options opts;
 		diff_setup(&opts);
-		opts.output_format |=
-			DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
+		switch (show_diffstat) {
+		case DIFF_STAT:
+			opts.output_format |=
+				DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
+			break;
+		case DYNAMIC_STAT:
+			opts.output_format |= DIFF_FORMAT_DYNSTAT;
+			break;
+		}
 		opts.detect_rename = DIFF_DETECT_RENAME;
 		if (diff_setup_done(&opts) < 0)
 			die(_("diff_setup_done failed"));
@@ -554,8 +567,15 @@ static int git_merge_config(const char *k, const char *v, void *cb)
 		return 0;
 	}
 
-	if (!strcmp(k, "merge.diffstat") || !strcmp(k, "merge.stat"))
-		show_diffstat = git_config_bool(k, v);
+	if (!strcmp(k, "merge.diffstat") || !strcmp(k, "merge.stat")) {
+		int val = git_config_maybe_bool(k, v);
+		if (val != -1)
+			show_diffstat = val ? DIFF_STAT : NO_STAT;
+		else if (!strcasecmp(v, "dynstat"))
+			show_diffstat = DYNAMIC_STAT;
+		else
+			die(_("unrecognized value \"%s\" for %s"), v, k);
+	}
 	else if (!strcmp(k, "pull.twohead"))
 		return git_config_string(&pull_twohead, k, v);
 	else if (!strcmp(k, "pull.octopus"))
-- 
1.7.3.1.256.g2539c.dirty
Previous: Nguyễn Thái Ngọc Duy
Message 6 of 6 in “Dynamic diff summary for merge/pull”
  1. 0/5 Dynamic diff summary for merge/pullNguyễn Thái Ngọc Duy, Jan 16, 2012
  2. 1/5 diff: add space around "="Nguyễn Thái Ngọc Duy, Jan 16, 2012
  3. 2/5 diff: do not duplicate shortstat with "git diff --stat --shortstat"Nguyễn Thái Ngọc Duy, Jan 16, 2012
  4. 3/5 diff: buffer dirstat outputNguyễn Thái Ngọc Duy, Jan 16, 2012
  5. 4/5 diff: add --dynstatNguyễn Thái Ngọc Duy, Jan 16, 2012
  6. 5/5 merge: support setting merge.[diff]stat to dynstatNguyễn Thái Ngọc Duy, Jan 16, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.