[PATCH 0/5] Dynamic diff summary for merge/pull
- From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Date
- Jan 16, 2012, 04:47 UTC
- Message-ID
- <1326689281-23788-1-git-send-email-pclouds@gmail.com>
On Sat, Jan 14, 2012 at 2:49 AM, Linus Torvalds <torvalds@linux-foundation.org> wrote:
Show 8 quoted lines
> 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(-)
-- 1.7.3.1.256.g2539c.dirty