From: Phillip Wood Date: Sun, 05 Jul 2026 13:42:18 GMT Subject: Re: [PATCH] diff: give --compact-summary a short synonym --sstat Message-ID: <4fa47057-0a14-4749-96f0-0efd3d50386d@gmail.com> In-Reply-To: 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 > --- > * 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=`, > `--stat-name-width=` and `--stat-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 > +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(-) > +$