{"thread":{"id":"65924","subject":"[PATCH] diff: give --compact-summary a short synonym --sstat","startedAt":"2026-07-05T04:28:04Z","lastAt":"2026-07-05T16:19:59Z","messageCount":3,"participants":["Junio C Hamano","Phillip Wood"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"547147","messageId":"xmqqldbqdpri.fsf@gitster.g","threadId":"65924","inReplyTo":null,"subject":"[PATCH] diff: give --compact-summary a short synonym --sstat","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-07-05T04:28:01Z","receivedAt":"2026-07-05T04:28:04Z","isPatch":true,"body":"These days I find myself using '--compact-summary' very often, which\nI consider is a strict superset of '--stat' (or '--stat --summary').\nPromote its use by giving it a short synonym '--sstat' (stands for\nsummary+stat).\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n * The `format-patch` output still uses --stat --summary, which\n   looks like so:\n\n Documentation/diff-options.adoc                      |  1 +\n diff.c                                               |  3 +++\n t/t4000-diff-format.sh                               |  2 +-\n t/t4013-diff-various.sh                              |  2 ++\n .../diff.diff-tree_--pretty_--root_--sstat_initial   | 12 ++++++++++++\n t/t4013/diff.diff-tree_-R_--sstat_initial_mode       |  4 ++++\n 6 files changed, 23 insertions(+), 1 deletion(-)\n create mode 100644 t/t4013/diff.diff-tree_--pretty_--root_--sstat_initial\n create mode 100644 t/t4013/diff.diff-tree_-R_--sstat_initial_mode\n\n   but if we change it to use --compact-summary (aka --sstat), it\n   would instead look like this:\n\n Documentation/diff-options.adoc                              |  1 +\n diff.c                                                       |  3 +++\n t/t4000-diff-format.sh                                       |  2 +-\n t/t4013-diff-various.sh                                      |  2 ++\n t/t4013/diff.diff-tree_--pretty_--root_--sstat_initial (new) | 12 ++++++++++++\n t/t4013/diff.diff-tree_-R_--sstat_initial_mode (new)         |  4 ++++\n 6 files changed, 23 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/diff-options.adoc b/Documentation/diff-options.adoc\nindex c8242e2462..b2b755fd3d 100644\n--- a/Documentation/diff-options.adoc\n+++ b/Documentation/diff-options.adoc\n@@ -221,6 +221,7 @@ These parameters can also be set individually with `--stat-width=<width>`,\n `--stat-name-width=<name-width>` and `--stat-count=<count>`.\n \n `--compact-summary`::\n+`--sstat`::\n \tOutput a condensed summary of extended header information such\n \tas file creations or deletions (\"new\" or \"gone\", optionally `+l`\n \tif it's a symlink) and mode changes (`+x` or `-x` for adding\ndiff --git a/diff.c b/diff.c\nindex 2a9d0d8687..284d391c47 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -6112,6 +6112,9 @@ struct option *add_diff_options(const struct option *opts,\n \t\tOPT_CALLBACK_F(0, \"compact-summary\", options, NULL,\n \t\t\t       N_(\"generate compact summary in diffstat\"),\n \t\t\t       PARSE_OPT_NOARG, diff_opt_compact_summary),\n+\t\tOPT_CALLBACK_F(0, \"sstat\", options, NULL,\n+\t\t\t       N_(\"generate compact summary in diffstat\"),\n+\t\t\t       PARSE_OPT_NOARG|PARSE_OPT_HIDDEN, diff_opt_compact_summary),\n \t\tOPT_CALLBACK_F(0, \"binary\", options, NULL,\n \t\t\t       N_(\"output a binary diff that can be applied\"),\n \t\t\t       PARSE_OPT_NONEG | PARSE_OPT_NOARG, diff_opt_binary),\ndiff --git a/t/t4000-diff-format.sh b/t/t4000-diff-format.sh\nindex 32b14e3a71..cc5c62fdbc 100755\n--- a/t/t4000-diff-format.sh\n+++ b/t/t4000-diff-format.sh\n@@ -101,7 +101,7 @@ date >path2/path3\n \n for format in stat raw numstat shortstat summary \\\n \tdirstat cumulative dirstat-by-file \\\n-\tpatch-with-raw patch-with-stat compact-summary\n+\tpatch-with-raw patch-with-stat compact-summary sstat\n do\n \ttest_expect_success \"--no-patch in 'git diff-files --no-patch --$format' is a no-op\" '\n \t\tgit diff-files --no-patch \"--$format\" >actual &&\ndiff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\nindex d35695f5b0..a42dca8a0b 100755\n--- a/t/t4013-diff-various.sh\n+++ b/t/t4013-diff-various.sh\n@@ -474,6 +474,8 @@ diff-tree --pretty --notes note\n diff-tree --format=%N note\n diff-tree --stat --compact-summary initial mode\n diff-tree -R --stat --compact-summary initial mode\n+diff-tree --pretty --root --sstat initial\n+diff-tree -R --sstat initial mode\n EOF\n \n test_expect_success !WITH_BREAKING_CHANGES 'whatchanged needs --i-still-use-this' '\ndiff --git a/t/t4013/diff.diff-tree_--pretty_--root_--sstat_initial b/t/t4013/diff.diff-tree_--pretty_--root_--sstat_initial\nnew file mode 100644\nindex 0000000000..b5c9d7693a\n--- /dev/null\n+++ b/t/t4013/diff.diff-tree_--pretty_--root_--sstat_initial\n@@ -0,0 +1,12 @@\n+$ git diff-tree --pretty --root --sstat initial\n+commit 444ac553ac7612cc88969031b02b3767fb8a353a\n+Author: A U Thor <author@example.com>\n+Date:   Mon Jun 26 00:00:00 2006 +0000\n+\n+    Initial\n+\n+ dir/sub (new) | 2 ++\n+ file0 (new)   | 3 +++\n+ file2 (new)   | 3 +++\n+ 3 files changed, 8 insertions(+)\n+$\ndiff --git a/t/t4013/diff.diff-tree_-R_--sstat_initial_mode b/t/t4013/diff.diff-tree_-R_--sstat_initial_mode\nnew file mode 100644\nindex 0000000000..51b1aa7d71\n--- /dev/null\n+++ b/t/t4013/diff.diff-tree_-R_--sstat_initial_mode\n@@ -0,0 +1,4 @@\n+$ git diff-tree -R --sstat initial mode\n+ file0 (mode -x) | 0\n+ 1 file changed, 0 insertions(+), 0 deletions(-)\n+$\n-- \n2.55.0-236-g7bd4d671b1\n\n"},{"id":"547163","messageId":"4fa47057-0a14-4749-96f0-0efd3d50386d@gmail.com","threadId":"65924","inReplyTo":"xmqqldbqdpri.fsf@gitster.g","subject":"Re: [PATCH] diff: give --compact-summary a short synonym --sstat","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2026-07-05T13:42:18Z","receivedAt":"2026-07-05T13:42:25Z","isPatch":true,"body":"Hi Junio\n\nOn 05/07/2026 05:28, Junio C Hamano wrote:\n> These days I find myself using '--compact-summary' very often, which\n> I consider is a strict superset of '--stat' (or '--stat --summary').\n> Promote its use by giving it a short synonym '--sstat' (stands for\n> summary+stat).\n\nThanks for the example below, it was useful to see the difference \nbetween \"--compact-summary\" and \"--stat --summary\". I'm afraid I don't \nthink adding a slightly cryptic shortened alias is a good idea. It is \nalready possible to tab-complete after typing \"--comp\" so I don't think \nthis is saving the user much typing and it clutters the UI with an \nobscure option name that could plausibly be an alias for \"--shortstat\".\n\nThanks\n\nPhillip\n\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>   * The `format-patch` output still uses --stat --summary, which\n>     looks like so:\n> \n>   Documentation/diff-options.adoc                      |  1 +\n>   diff.c                                               |  3 +++\n>   t/t4000-diff-format.sh                               |  2 +-\n>   t/t4013-diff-various.sh                              |  2 ++\n>   .../diff.diff-tree_--pretty_--root_--sstat_initial   | 12 ++++++++++++\n>   t/t4013/diff.diff-tree_-R_--sstat_initial_mode       |  4 ++++\n>   6 files changed, 23 insertions(+), 1 deletion(-)\n>   create mode 100644 t/t4013/diff.diff-tree_--pretty_--root_--sstat_initial\n>   create mode 100644 t/t4013/diff.diff-tree_-R_--sstat_initial_mode\n> \n>     but if we change it to use --compact-summary (aka --sstat), it\n>     would instead look like this:\n> \n>   Documentation/diff-options.adoc                              |  1 +\n>   diff.c                                                       |  3 +++\n>   t/t4000-diff-format.sh                                       |  2 +-\n>   t/t4013-diff-various.sh                                      |  2 ++\n>   t/t4013/diff.diff-tree_--pretty_--root_--sstat_initial (new) | 12 ++++++++++++\n>   t/t4013/diff.diff-tree_-R_--sstat_initial_mode (new)         |  4 ++++\n>   6 files changed, 23 insertions(+), 1 deletion(-)\n> \n> diff --git a/Documentation/diff-options.adoc b/Documentation/diff-options.adoc\n> index c8242e2462..b2b755fd3d 100644\n> --- a/Documentation/diff-options.adoc\n> +++ b/Documentation/diff-options.adoc\n> @@ -221,6 +221,7 @@ These parameters can also be set individually with `--stat-width=<width>`,\n>   `--stat-name-width=<name-width>` and `--stat-count=<count>`.\n>   \n>   `--compact-summary`::\n> +`--sstat`::\n>   \tOutput a condensed summary of extended header information such\n>   \tas file creations or deletions (\"new\" or \"gone\", optionally `+l`\n>   \tif it's a symlink) and mode changes (`+x` or `-x` for adding\n> diff --git a/diff.c b/diff.c\n> index 2a9d0d8687..284d391c47 100644\n> --- a/diff.c\n> +++ b/diff.c\n> @@ -6112,6 +6112,9 @@ struct option *add_diff_options(const struct option *opts,\n>   \t\tOPT_CALLBACK_F(0, \"compact-summary\", options, NULL,\n>   \t\t\t       N_(\"generate compact summary in diffstat\"),\n>   \t\t\t       PARSE_OPT_NOARG, diff_opt_compact_summary),\n> +\t\tOPT_CALLBACK_F(0, \"sstat\", options, NULL,\n> +\t\t\t       N_(\"generate compact summary in diffstat\"),\n> +\t\t\t       PARSE_OPT_NOARG|PARSE_OPT_HIDDEN, diff_opt_compact_summary),\n>   \t\tOPT_CALLBACK_F(0, \"binary\", options, NULL,\n>   \t\t\t       N_(\"output a binary diff that can be applied\"),\n>   \t\t\t       PARSE_OPT_NONEG | PARSE_OPT_NOARG, diff_opt_binary),\n> diff --git a/t/t4000-diff-format.sh b/t/t4000-diff-format.sh\n> index 32b14e3a71..cc5c62fdbc 100755\n> --- a/t/t4000-diff-format.sh\n> +++ b/t/t4000-diff-format.sh\n> @@ -101,7 +101,7 @@ date >path2/path3\n>   \n>   for format in stat raw numstat shortstat summary \\\n>   \tdirstat cumulative dirstat-by-file \\\n> -\tpatch-with-raw patch-with-stat compact-summary\n> +\tpatch-with-raw patch-with-stat compact-summary sstat\n>   do\n>   \ttest_expect_success \"--no-patch in 'git diff-files --no-patch --$format' is a no-op\" '\n>   \t\tgit diff-files --no-patch \"--$format\" >actual &&\n> diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh\n> index d35695f5b0..a42dca8a0b 100755\n> --- a/t/t4013-diff-various.sh\n> +++ b/t/t4013-diff-various.sh\n> @@ -474,6 +474,8 @@ diff-tree --pretty --notes note\n>   diff-tree --format=%N note\n>   diff-tree --stat --compact-summary initial mode\n>   diff-tree -R --stat --compact-summary initial mode\n> +diff-tree --pretty --root --sstat initial\n> +diff-tree -R --sstat initial mode\n>   EOF\n>   \n>   test_expect_success !WITH_BREAKING_CHANGES 'whatchanged needs --i-still-use-this' '\n> diff --git a/t/t4013/diff.diff-tree_--pretty_--root_--sstat_initial b/t/t4013/diff.diff-tree_--pretty_--root_--sstat_initial\n> new file mode 100644\n> index 0000000000..b5c9d7693a\n> --- /dev/null\n> +++ b/t/t4013/diff.diff-tree_--pretty_--root_--sstat_initial\n> @@ -0,0 +1,12 @@\n> +$ git diff-tree --pretty --root --sstat initial\n> +commit 444ac553ac7612cc88969031b02b3767fb8a353a\n> +Author: A U Thor <author@example.com>\n> +Date:   Mon Jun 26 00:00:00 2006 +0000\n> +\n> +    Initial\n> +\n> + dir/sub (new) | 2 ++\n> + file0 (new)   | 3 +++\n> + file2 (new)   | 3 +++\n> + 3 files changed, 8 insertions(+)\n> +$\n> diff --git a/t/t4013/diff.diff-tree_-R_--sstat_initial_mode b/t/t4013/diff.diff-tree_-R_--sstat_initial_mode\n> new file mode 100644\n> index 0000000000..51b1aa7d71\n> --- /dev/null\n> +++ b/t/t4013/diff.diff-tree_-R_--sstat_initial_mode\n> @@ -0,0 +1,4 @@\n> +$ git diff-tree -R --sstat initial mode\n> + file0 (mode -x) | 0\n> + 1 file changed, 0 insertions(+), 0 deletions(-)\n> +$\n\n"},{"id":"547165","messageId":"xmqq4iide7de.fsf@gitster.g","threadId":"65924","inReplyTo":"4fa47057-0a14-4749-96f0-0efd3d50386d@gmail.com","subject":"Re: [PATCH] diff: give --compact-summary a short synonym --sstat","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-07-05T16:19:57Z","receivedAt":"2026-07-05T16:19:59Z","isPatch":true,"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> ... this is saving the user much typing and it clutters the UI with an \n> obscure option name that could plausibly be an alias for \"--shortstat\".\n\nFair enough.  Thanks for a doze of sanity.\n\n"}]}