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

From:
Mark Jamsek <mark@jamsek.com>
Subject:
Re: got: add diffstat to got diffg
To:
Game of Trees <gameoftrees@openbsd.org>
Date:
Mon, 9 Jan 2023 19:21:31 +1100

Download raw body.

Thread
  • Stefan Sperling:

    got: add diffstat to got diffg

  • On 23-01-08 06:01PM, Stefan Sperling wrote:
    > 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?
    
    Yes, I basically went for a 'git diff --stat' UI. But you make a good
    point: it's only really useful in the context of a full diff.
    
    You've given me something to think about. I'm heading off for dinner and
    will consider it further. But I think you're right and 'got diff -d'
    should always output the diff too. Leave it with me and I'll work on
    this when I get back. Thanks, Stefan!
    
    -- 
    Mark Jamsek <fnc.bsdbox.org>
    GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68
    
  • Stefan Sperling:

    got: add diffstat to got diffg