"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: got: add diffstat to got diffg
To:
Mark Jamsek <mark@jamsek.com>
Cc:
Game of Trees <gameoftrees@openbsd.org>
Date:
Sun, 8 Jan 2023 18:01:46 +0100

Download raw body.

Thread
On Mon, Jan 09, 2023 at 03:11:01AM +1100, Mark Jamsek wrote:
> Like the recent 'got log -d' addition, display a diffstat if the -d
> switch is passed to 'got diff'.
> 
> Output is slightly different, we don't add a blank line between the last
> file line and the summary line like we do with got log and the tog diff
> view; I think it looks a bit disconnected when we do it in this case.
> And for the `got diff blob-hash blob-hash` case, like `git diff --stat`,
> we show blob hashes rather than a file path; for example:
> 
> ----8<---------------------------------------------------------------
>   ~/src/got ยป g diff -d 5e9010e76c3a c9a5f834b0a
>    M  5e9010e76c -> c9a5f834b0  |  193+  81-
>   1 file changed, 193 insertions(+), 81 deletions(-)
> 
>    ---

Some thoughts regarding the UI:

Consider the output of: got diff -c main -d

diff 9b7f22a6148eb14af6e59de120bb5b1dd0e05469 refs/heads/main
commit - 9b7f22a6148eb14af6e59de120bb5b1dd0e05469
commit + 6b5e61245844733fe2df78892399d5956f422311
 M  gotd/log.c  |  3+  4-
1 file changed, 3 insertions(+), 4 deletions(-)

Since we're not actually showing a diff, perhaps the first line should
say "diffstat" instead of "diff"? Like this:
  diffstat 9b7f22a6148eb14af6e59de120bb5b1dd0e05469 refs/heads/main

But I am also wondering whether it would make sense to keep showing the
full diff even with -d, such that we display a diffstat above the full
diff, like we in tog diff. To me it seems like a diffstat is rarely
useful in isolation, but maybe I am missing some use case?
It seems you were aiming towards the output of git --stat. And of course
git also has a --patch-with-stat option! Which might be more the useful
output to show if we are only going to have one such option? Or should
we have two options as well?