git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Eric Sunshine" <sunshine@sunshineco.com>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH v4 0/2] diff: add --compact-summary (aka nd/diff-stat-with-summary)
Date: Sat, 24 Feb 2018 21:05:07 +0700	[thread overview]
Message-ID: <20180224140509.25061-1-pclouds@gmail.com> (raw)
In-Reply-To: <20180201130221.15563-1-pclouds@gmail.com>

v4 renames the option back to --compact-summary. I can't think of any
better name.

Interdiff

diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 595e4cd548..e3a44f03cd 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -128,7 +128,7 @@ have to use `--diff-algorithm=default` option.
 These parameters can also be set individually with `--stat-width=<width>`,
 `--stat-name-width=<name-width>` and `--stat-count=<count>`.
 
---stat-with-summary::
+--compact-summary::
 	Output a condensed summary of extended header information such
 	as file creations or deletions ("new" or "gone", optionally "+l"
 	if it's a symlink) and mode changes ("+x" or "-x" for adding
diff --git a/diff.c b/diff.c
index e7ff7dceb7..62e413a80f 100644
--- a/diff.c
+++ b/diff.c
@@ -4332,7 +4332,6 @@ static int stat_opt(struct diff_options *options, const char **av)
 	int graph_width = options->stat_graph_width;
 	int count = options->stat_count;
 	int argcount = 1;
-	unsigned with_summary = options->flags.stat_with_summary;
 
 	if (!skip_prefix(arg, "--stat", &arg))
 		die("BUG: stat option does not begin with --stat: %s", arg);
@@ -4376,9 +4375,6 @@ static int stat_opt(struct diff_options *options, const char **av)
 				count = strtoul(av[1], &end, 10);
 				argcount = 2;
 			}
-		} else if (skip_prefix(arg, "-with-summary", &arg)) {
-			with_summary = 1;
-			end = (char*)arg;
 		}
 		break;
 	case '=':
@@ -4397,7 +4393,6 @@ static int stat_opt(struct diff_options *options, const char **av)
 	options->stat_graph_width = graph_width;
 	options->stat_width = width;
 	options->stat_count = count;
-	options->flags.stat_with_summary = with_summary;
 	return argcount;
 }
 
@@ -4579,11 +4574,13 @@ int diff_opt_parse(struct diff_options *options,
 	else if (!strcmp(arg, "-s") || !strcmp(arg, "--no-patch"))
 		options->output_format |= DIFF_FORMAT_NO_OUTPUT;
 	else if (starts_with(arg, "--stat"))
-		/*
-		 * --stat, --stat-width, --stat-name-width,
-		 * --stat-count or --stat-with-summary.
-		 */
+		/* --stat, --stat-width, --stat-name-width, or --stat-count */
 		return stat_opt(options, av);
+	else if (!strcmp(arg, "--compact-summary")) {
+		 options->flags.stat_with_summary = 1;
+		 options->output_format |= DIFF_FORMAT_DIFFSTAT;
+	} else if (!strcmp(arg, "--no-compact-summary"))
+		 options->flags.stat_with_summary = 0;
 
 	/* renames options */
 	else if (starts_with(arg, "-B") ||
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index aa6f5da21c..3f9a24fd56 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -362,10 +362,10 @@ diff --no-index --raw --abbrev=4 dir2 dir
 :noellipses diff --no-index --raw --abbrev=4 dir2 dir
 diff --no-index --raw --no-abbrev dir2 dir
 
-diff-tree --pretty --root --stat-with-summary initial
-diff-tree --pretty -R --root --stat-with-summary initial
-diff-tree --stat-with-summary initial mode
-diff-tree -R --stat-with-summary initial mode
+diff-tree --pretty --root --stat --compact-summary initial
+diff-tree --pretty -R --root --stat --compact-summary initial
+diff-tree --stat --compact-summary initial mode
+diff-tree -R --stat --compact-summary initial mode
 EOF
 
 test_expect_success 'log -S requires an argument' '
diff --git a/t/t4013/diff.diff-tree_--pretty_--root_--stat-with-summary_initial b/t/t4013/diff.diff-tree_--pretty_--root_--stat_--compact-summary_initial
similarity index 78%
rename from t/t4013/diff.diff-tree_--pretty_--root_--stat-with-summary_initial
rename to t/t4013/diff.diff-tree_--pretty_--root_--stat_--compact-summary_initial
index 105f29a92d..d6451ff7cc 100644
--- a/t/t4013/diff.diff-tree_--pretty_--root_--stat-with-summary_initial
+++ b/t/t4013/diff.diff-tree_--pretty_--root_--stat_--compact-summary_initial
@@ -1,4 +1,4 @@
-$ git diff-tree --pretty --root --stat-with-summary initial
+$ git diff-tree --pretty --root --stat --compact-summary initial
 commit 444ac553ac7612cc88969031b02b3767fb8a353a
 Author: A U Thor <author@example.com>
 Date:   Mon Jun 26 00:00:00 2006 +0000
diff --git a/t/t4013/diff.diff-tree_--pretty_-R_--root_--stat-with-summary_initial b/t/t4013/diff.diff-tree_--pretty_-R_--root_--stat_--compact-summary_initial
similarity index 78%
rename from t/t4013/diff.diff-tree_--pretty_-R_--root_--stat-with-summary_initial
rename to t/t4013/diff.diff-tree_--pretty_-R_--root_--stat_--compact-summary_initial
index 45008d09fc..1989e55cd0 100644
--- a/t/t4013/diff.diff-tree_--pretty_-R_--root_--stat-with-summary_initial
+++ b/t/t4013/diff.diff-tree_--pretty_-R_--root_--stat_--compact-summary_initial
@@ -1,4 +1,4 @@
-$ git diff-tree --pretty -R --root --stat-with-summary initial
+$ git diff-tree --pretty -R --root --stat --compact-summary initial
 commit 444ac553ac7612cc88969031b02b3767fb8a353a
 Author: A U Thor <author@example.com>
 Date:   Mon Jun 26 00:00:00 2006 +0000
diff --git a/t/t4013/diff.diff-tree_--stat-with-summary_initial_mode b/t/t4013/diff.diff-tree_--stat_--compact-summary_initial_mode
similarity index 57%
rename from t/t4013/diff.diff-tree_--stat-with-summary_initial_mode
rename to t/t4013/diff.diff-tree_--stat_--compact-summary_initial_mode
index f99fcdc101..9c7c8f63af 100644
--- a/t/t4013/diff.diff-tree_--stat-with-summary_initial_mode
+++ b/t/t4013/diff.diff-tree_--stat_--compact-summary_initial_mode
@@ -1,4 +1,4 @@
-$ git diff-tree --stat-with-summary initial mode
+$ git diff-tree --stat --compact-summary initial mode
  file0 (mode +x) | 0
  1 file changed, 0 insertions(+), 0 deletions(-)
 $
diff --git a/t/t4013/diff.diff-tree_-R_--stat-with-summary_initial_mode b/t/t4013/diff.diff-tree_-R_--stat_--compact-summary_initial_mode
similarity index 55%
rename from t/t4013/diff.diff-tree_-R_--stat-with-summary_initial_mode
rename to t/t4013/diff.diff-tree_-R_--stat_--compact-summary_initial_mode
index 8dc8f3fe95..e38f3d3bfb 100644
--- a/t/t4013/diff.diff-tree_-R_--stat-with-summary_initial_mode
+++ b/t/t4013/diff.diff-tree_-R_--stat_--compact-summary_initial_mode
@@ -1,4 +1,4 @@
-$ git diff-tree -R --stat-with-summary initial mode
+$ git diff-tree -R --stat --compact-summary initial mode
  file0 (mode -x) | 0
  1 file changed, 0 insertions(+), 0 deletions(-)
 $
-- 
2.16.1.435.g8f24da2e1a


  parent reply	other threads:[~2018-02-24 14:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-01 13:02 [PATCH v3 0/2] diff: add --stat-with-summary (was --compact-summary) Nguyễn Thái Ngọc Duy
2018-02-01 13:02 ` [PATCH v3 1/2] diff.c: refactor pprint_rename() to use strbuf Nguyễn Thái Ngọc Duy
2018-02-01 13:02 ` [PATCH v3 2/2] diff: add --stat-with-summary Nguyễn Thái Ngọc Duy
2018-02-02 19:59 ` [PATCH v3 0/2] diff: add --stat-with-summary (was --compact-summary) Junio C Hamano
2018-02-05 11:28   ` Duy Nguyen
2018-02-05 18:56     ` Junio C Hamano
2018-02-06 10:20       ` Duy Nguyen
2018-02-07  9:52         ` Eric Sunshine
2018-02-07 10:36           ` Duy Nguyen
2018-02-07 18:19             ` Junio C Hamano
2018-02-10 10:24               ` Duy Nguyen
2018-02-10 20:08                 ` Junio C Hamano
2018-02-24 14:05 ` Nguyễn Thái Ngọc Duy [this message]
2018-02-24 14:05   ` [PATCH v4 1/2] diff.c: refactor pprint_rename() to use strbuf Nguyễn Thái Ngọc Duy
2018-02-24 14:05   ` [PATCH v4 2/2] diff: add --stat-with-summary Nguyễn Thái Ngọc Duy
2018-02-24 14:09   ` [PATCH v5 0/2] diff: add --compact-summary (aka nd/diff-stat-with-summary) Nguyễn Thái Ngọc Duy
2018-02-24 14:09     ` [PATCH v5 1/2] diff.c: refactor pprint_rename() to use strbuf Nguyễn Thái Ngọc Duy
2018-02-24 14:09     ` [PATCH v5 2/2] diff: add --compact-summary Nguyễn Thái Ngọc Duy
2018-02-27 23:24     ` [PATCH v5 0/2] diff: add --compact-summary (aka nd/diff-stat-with-summary) Junio C Hamano

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=20180224140509.25061-1-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sunshine@sunshineco.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).