Git development
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH] diff: give --compact-summary a short synonym --sstat
Date: Sun, 5 Jul 2026 14:42:18 +0100	[thread overview]
Message-ID: <4fa47057-0a14-4749-96f0-0efd3d50386d@gmail.com> (raw)
In-Reply-To: <xmqqldbqdpri.fsf@gitster.g>

Hi Junio

On 05/07/2026 05:28, Junio C Hamano wrote:
> 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).

Thanks for the example below, it was useful to see the difference 
between "--compact-summary" and "--stat --summary". I'm afraid I don't 
think adding a slightly cryptic shortened alias is a good idea. It is 
already possible to tab-complete after typing "--comp" so I don't think 
this is saving the user much typing and it clutters the UI with an 
obscure option name that could plausibly be an alias for "--shortstat".

Thanks

Phillip

> 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(-)
> +$


  reply	other threads:[~2026-07-05 13:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-05  4:28 [PATCH] diff: give --compact-summary a short synonym --sstat Junio C Hamano
2026-07-05 13:42 ` Phillip Wood [this message]
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=4fa47057-0a14-4749-96f0-0efd3d50386d@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=phillip.wood@dunelm.org.uk \
    /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