Skip to content

Dynamic diff summary for merge/pull

Nguyễn Thái Ngọc Duy git 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5diff: add space around "="diff.c+1 -10 replies
2/5diff: do not duplicate shortstat with "git diff --stat --shortstat"diff.c+3 -40 replies
3/5diff: buffer dirstat outputdiff.c+14 -40 replies
4/5diff: add --dynstatdiff.c diff.h+92 -90 replies
5/5merge: support setting merge.[diff]stat to dynstatbuiltin/merge.c+25 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/5] Dynamic diff summary for merge/pull
Quoted 8 lines · Linus Torvalds

And what I've *really* wanted is to actually see the diff itself if it
is small. So some kind of "dynamic summary": for one-liners (or ten-liners), show the whole diff. For medium-sized changes, show the whole diffstat. And for really big changes, show an outline and the "768 files changed, 179851 lines added, 7630 lines removed" stats.

IOW, whatever fits in, say, 50 lines or less.

Here's an attempt to do that. The main patch is 4/5 to implement --dynstat. 5/5 just makes merge/pull pass --dynstat to diff machinery.

--dynstat tries various diff output and use one that fits within 50 lines:

--patch + --shortstat
--stat (maybe plus --summary)
--dirstat + --shortstat
--shortstat

Many hardcoded constants should be more flexible (i.e. 50 lines limit could be retrieved from terminal settigns), but that's minor for now imo. I think we should also hint users to do
"git diff --stat --summary HEAD@{1} HEAD" too via advice framework if we turn --dynstat to default for merge/pull

I have not run "make test" so it may break a few tests because of 2/2.

Nguyễn Thái Ngọc Duy (5):
diff: add space around "="
diff: do not duplicate shortstat with "git diff --stat --shortstat"
diff: buffer dirstat output
diff: add --dynstat
merge: support setting merge.[diff]stat to dynstat

 builtin/merge.c |   30 +++++++++++--
 diff.c          |  127 +++++++++++++++++++++++++++++++++++++++++++++++--------
 diff.h          |    1 +
 3 files changed, 135 insertions(+), 23 deletions(-)
Signature · 1 line
1.7.3.1.256.g2539c.dirty