All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH] diff: give --compact-summary a short synonym --sstat
Date: Sat, 04 Jul 2026 21:28:01 -0700	[thread overview]
Message-ID: <xmqqldbqdpri.fsf@gitster.g> (raw)

These days I find myself using '--compact-summary' very often, which
I consider is a strict superset of '--stat' (or '--stat --summary').
Promote its use by giving it a short synonym '--sstat' (stands for
summary+stat).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 * The `format-patch` output still uses --stat --summary, which
   looks like so:

 Documentation/diff-options.adoc                      |  1 +
 diff.c                                               |  3 +++
 t/t4000-diff-format.sh                               |  2 +-
 t/t4013-diff-various.sh                              |  2 ++
 .../diff.diff-tree_--pretty_--root_--sstat_initial   | 12 ++++++++++++
 t/t4013/diff.diff-tree_-R_--sstat_initial_mode       |  4 ++++
 6 files changed, 23 insertions(+), 1 deletion(-)
 create mode 100644 t/t4013/diff.diff-tree_--pretty_--root_--sstat_initial
 create mode 100644 t/t4013/diff.diff-tree_-R_--sstat_initial_mode

   but if we change it to use --compact-summary (aka --sstat), it
   would instead look like this:

 Documentation/diff-options.adoc                              |  1 +
 diff.c                                                       |  3 +++
 t/t4000-diff-format.sh                                       |  2 +-
 t/t4013-diff-various.sh                                      |  2 ++
 t/t4013/diff.diff-tree_--pretty_--root_--sstat_initial (new) | 12 ++++++++++++
 t/t4013/diff.diff-tree_-R_--sstat_initial_mode (new)         |  4 ++++
 6 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/Documentation/diff-options.adoc b/Documentation/diff-options.adoc
index c8242e2462..b2b755fd3d 100644
--- a/Documentation/diff-options.adoc
+++ b/Documentation/diff-options.adoc
@@ -221,6 +221,7 @@ These parameters can also be set individually with `--stat-width=<width>`,
 `--stat-name-width=<name-width>` and `--stat-count=<count>`.
 
 `--compact-summary`::
+`--sstat`::
 	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 2a9d0d8687..284d391c47 100644
--- a/diff.c
+++ b/diff.c
@@ -6112,6 +6112,9 @@ struct option *add_diff_options(const struct option *opts,
 		OPT_CALLBACK_F(0, "compact-summary", options, NULL,
 			       N_("generate compact summary in diffstat"),
 			       PARSE_OPT_NOARG, diff_opt_compact_summary),
+		OPT_CALLBACK_F(0, "sstat", options, NULL,
+			       N_("generate compact summary in diffstat"),
+			       PARSE_OPT_NOARG|PARSE_OPT_HIDDEN, diff_opt_compact_summary),
 		OPT_CALLBACK_F(0, "binary", options, NULL,
 			       N_("output a binary diff that can be applied"),
 			       PARSE_OPT_NONEG | PARSE_OPT_NOARG, diff_opt_binary),
diff --git a/t/t4000-diff-format.sh b/t/t4000-diff-format.sh
index 32b14e3a71..cc5c62fdbc 100755
--- a/t/t4000-diff-format.sh
+++ b/t/t4000-diff-format.sh
@@ -101,7 +101,7 @@ date >path2/path3
 
 for format in stat raw numstat shortstat summary \
 	dirstat cumulative dirstat-by-file \
-	patch-with-raw patch-with-stat compact-summary
+	patch-with-raw patch-with-stat compact-summary sstat
 do
 	test_expect_success "--no-patch in 'git diff-files --no-patch --$format' is a no-op" '
 		git diff-files --no-patch "--$format" >actual &&
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index d35695f5b0..a42dca8a0b 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -474,6 +474,8 @@ diff-tree --pretty --notes note
 diff-tree --format=%N note
 diff-tree --stat --compact-summary initial mode
 diff-tree -R --stat --compact-summary initial mode
+diff-tree --pretty --root --sstat initial
+diff-tree -R --sstat initial mode
 EOF
 
 test_expect_success !WITH_BREAKING_CHANGES 'whatchanged needs --i-still-use-this' '
diff --git a/t/t4013/diff.diff-tree_--pretty_--root_--sstat_initial b/t/t4013/diff.diff-tree_--pretty_--root_--sstat_initial
new file mode 100644
index 0000000000..b5c9d7693a
--- /dev/null
+++ b/t/t4013/diff.diff-tree_--pretty_--root_--sstat_initial
@@ -0,0 +1,12 @@
+$ git diff-tree --pretty --root --sstat initial
+commit 444ac553ac7612cc88969031b02b3767fb8a353a
+Author: A U Thor <author@example.com>
+Date:   Mon Jun 26 00:00:00 2006 +0000
+
+    Initial
+
+ dir/sub (new) | 2 ++
+ file0 (new)   | 3 +++
+ file2 (new)   | 3 +++
+ 3 files changed, 8 insertions(+)
+$
diff --git a/t/t4013/diff.diff-tree_-R_--sstat_initial_mode b/t/t4013/diff.diff-tree_-R_--sstat_initial_mode
new file mode 100644
index 0000000000..51b1aa7d71
--- /dev/null
+++ b/t/t4013/diff.diff-tree_-R_--sstat_initial_mode
@@ -0,0 +1,4 @@
+$ git diff-tree -R --sstat initial mode
+ file0 (mode -x) | 0
+ 1 file changed, 0 insertions(+), 0 deletions(-)
+$
-- 
2.55.0-236-g7bd4d671b1


             reply	other threads:[~2026-07-05  4:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-05  4:28 Junio C Hamano [this message]
2026-07-05 13:42 ` [PATCH] diff: give --compact-summary a short synonym --sstat Phillip Wood
2026-07-05 16:19   ` 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=xmqqldbqdpri.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.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 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.