git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] diff: add --compact-summary option to complement --stat

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jan 18, 2018, 21:23 UTC
Message-ID
<87bmhqj1y6.fsf@evledraar.gmail.com>
In-Reply-To
<20180118100546.32251-1-pclouds@gmail.com>
On Thu, Jan 18 2018, Nguyễn Thái Ngọc Duy jotted:
Show 10 quoted lines
> This is partly inspired by gerrit web interface which shows diffstat
> like this, e.g. with commit 0433d533f1 (notice the "A" column on the
> third line):
>
>
>      Documentation/merge-config.txt     |  4 +
>      builtin/merge.c                    |  2 +
>    A t/t5573-pull-verify-signatures.sh  | 81 ++++++++++++++++++
>      t/t7612-merge-verify-signatures.sh | 45 ++++++++++
>    4 files changed, 132 insertions(+)

This feature is awesome. This has bothered me about --stat, but I haven't done anything about it.

> In other words, certain information currently shown with --summary is
> embedded in the diffstat. This helps reading (all information of the
> same file in the same line instead of two) and can reduce the number of
> lines if you add/delete a lot of files.

Wait, isn't there a bug here in the existing --summary code, its documentation says it'll show information "such as creations, renames and mode changes".

But even though your --compact-summary shows that the file is being added and its mode changed:

    $ diff -ru <(./git-show --stat 0433d533f1) <(./git-show --stat --compact-summary 0433d533f1)
    --- /dev/fd/63  2018-01-18 21:11:51.186570555 +0000
    +++ /dev/fd/62  2018-01-18 21:11:51.186570555 +0000
    @@ -14,8 +14,8 @@
           t: add tests for pull --verify-signatures
           merge: add config option for verifySignatures
    - Documentation/merge-config.txt     |  4 ++
    - builtin/merge.c                    |  2 +
    - t/t5573-pull-verify-signatures.sh  | 81 ++++++++++++++++++++++++++++++++++++++
    - t/t7612-merge-verify-signatures.sh | 45 +++++++++++++++++++++
    +     Documentation/merge-config.txt     |  4 ++
    +     builtin/merge.c                    |  2 +
    + A+x t/t5573-pull-verify-signatures.sh  | 81 ++++++++++++++++++++++++++++++++++
    +     t/t7612-merge-verify-signatures.sh | 45 +++++++++++++++++++
      4 files changed, 132 insertions(+)

There is no difference between --stat with and without --summary on the same commit, shouldn't it show "create mode [...]" ?

E.g. 95450bbbaa will do the trick for both:
    $ diff -ru <(./git-show --stat 95450bbbaa) <(./git-show --stat --summary 95450bbbaa)
    --- /dev/fd/63  2018-01-18 21:14:20.770050599 +0000
    +++ /dev/fd/62  2018-01-18 21:14:20.770050599 +0000
    @@ -14,3 +14,4 @@
      git-svn.perl                    |  1 +
      t/t9169-git-svn-dcommit-crlf.sh | 27 +++++++++++++++++++++++++++
      2 files changed, 28 insertions(+)
    + create mode 100755 t/t9169-git-svn-dcommit-crlf.sh
    $ diff -ru <(./git-show --stat --summary 95450bbbaa) <(./git-show --stat --compact-summary 95450bbbaa)
    --- /dev/fd/63  2018-01-18 21:14:30.646016210 +0000
    +++ /dev/fd/62  2018-01-18 21:14:30.646016210 +0000
    @@ -11,7 +11,6 @@
         Reported-by: Brian Bennett <Brian.Bennett@Transamerica.com>
         Signed-off-by: Eric Wong <e@80x24.org>
    - git-svn.perl                    |  1 +
    - t/t9169-git-svn-dcommit-crlf.sh | 27 +++++++++++++++++++++++++++
    +     git-svn.perl                    |  1 +
    + A+x t/t9169-git-svn-dcommit-crlf.sh | 27 +++++++++++++++++++++++++++
      2 files changed, 28 insertions(+)
    - create mode 100755 t/t9169-git-svn-dcommit-crlf.sh
Show 5 quoted lines
> +--compact-summary::
> +	Output a condensed summary of extended header information in
> +	front of the file name part of diffstat. This option is
> +	ignored if --stat is not specified.
> ++

If for some reason the lack of information about the commit under --summary isn't a bug/fixable it makes sense to document the differences here.

> +File creations or deletions are denoted wigth "A" or "D" respectively,
s/wigth/with/
> +optionally "+l" if it's a symlink, or "+x" if it's executable.
> +Mode changes are shown "M+x" or "M-x" for adding or removing
"Mode changes are shown as" is better worded.
Previous: Duy NguyenNext: Duy Nguyen
Message 8 of 14 in “diff: add --compact-summary option to complement --stat”
  1. diff: add --compact-summary option to complement --statNguyễn Thái Ngọc Duy, Jan 13, 2018
  2. Philip OakleyJan 13, 2018
  3. Simon RuderichJan 14, 2018
  4. Duy NguyenJan 14, 2018
  5. diff: add --compact-summary option to complement --statNguyễn Thái Ngọc Duy, Jan 18, 2018
  6. Eric SunshineJan 18, 2018
  7. Duy NguyenJan 19, 2018
  8. Ævar Arnfjörð BjarmasonJan 18, 2018
  9. Duy NguyenJan 19, 2018
  10. Jeff KingJan 18, 2018
  11. Duy NguyenJan 19, 2018
  12. Jeff KingJan 19, 2018
  13. Junio C HamanoJan 19, 2018
  14. Jeff KingJan 19, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.