Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃殌 Count number of changes / additions / deletions #591

Open
disrupted opened this issue May 5, 2021 · 4 comments
Open

馃殌 Count number of changes / additions / deletions #591

disrupted opened this issue May 5, 2021 · 4 comments

Comments

@disrupted
Copy link

Thank you very much for this brilliant tool!

It would be nice if the header could display number of changes (and/or additions|deletions) in a file, similar to how GitHub shows this information.
I looked through the docs and couldn't find it so I guess it hasn't been implemented yet.

@dandavison
Copy link
Owner

Hi @disrupted, thanks for this. Is your request satisfied by using the --stat argument to git diff/show/log etc? That gives output like this with delta:

image

@disrupted
Copy link
Author

disrupted commented May 28, 2021

@dandavison this definitely goes in the right direction and I didn't know about it, so thanks for pointing it out.

I was thinking something more like this, where it would show the number of changes (additions/deletions) in the header for each file.

file header on GitHub showing number of changes

Most of the time I use delta with fzf (inside of forgit) so it would be really cool to show this information. Here's a small mockup of what I mean:

delta_changecount_mockup

@dandavison
Copy link
Owner

Hi @disrupted, I agree that could be nice. One concern however is that delta would have to process an entire file before starting to emit any of the output for that file, in order for it to be able to compute the diff summary. At the moment delta's processing is more stream-oriented than that, and it would raise the possibility of poor performance in the case of large files.

@Kr1ss-XD
Copy link
Contributor

I like that idea, too !

Maybe the --shortstat option comes close to what @disrupted is imagining. It can be used with git diff -p, git show -p and git log -p.

As with --stat, git would do the calculation (and git is pretty efficient in that).

examples - click to expand

delta_shortstat-demo

There are some caveats though :

  1. When using with git diff or git show, you need to also apply the -p/--patch flag; otherwise only the shortstat will be outputted.
  2. It will be a summary of changes in all files affected by the according commit. (There's the --numstat option, but that will output all statistics as a header, followed by all the diffs, and it would probably need to be parsed and reformatted.) I'm not aware of any way to have shortstats for each individual file inline, but maybe that's also possible somehow ? After all, git is a Jack of all trades in many regards... 馃槅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants