From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Linus Torvalds" <torvalds@linux-foundation.org>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 5/5] merge: support setting merge.[diff]stat to dynstat
Date: Mon, 16 Jan 2012 11:48:01 +0700 [thread overview]
Message-ID: <1326689281-23788-6-git-send-email-pclouds@gmail.com> (raw)
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
prev parent reply other threads:[~2012-01-16 4:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-16 4:47 [PATCH 0/5] Dynamic diff summary for merge/pull Nguyễn Thái Ngọc Duy
2012-01-16 4:47 ` [PATCH 1/5] diff: add space around "=" Nguyễn Thái Ngọc Duy
2012-01-16 4:47 ` [PATCH 2/5] diff: do not duplicate shortstat with "git diff --stat --shortstat" Nguyễn Thái Ngọc Duy
2012-01-16 4:47 ` [PATCH 3/5] diff: buffer dirstat output Nguyễn Thái Ngọc Duy
2012-01-16 4:48 ` [PATCH 4/5] diff: add --dynstat Nguyễn Thái Ngọc Duy
2012-01-16 4:48 ` Nguyễn Thái Ngọc Duy [this message]
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=1326689281-23788-6-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=torvalds@linux-foundation.org \
/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).