From: Linus Torvalds <torvalds@linux-foundation.org>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Junio C Hamano <gitster@pobox.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: Add "--dirstat" for some directory statistics
Date: Mon, 11 Feb 2008 14:06:10 -0800 (PST) [thread overview]
Message-ID: <alpine.LFD.1.00.0802111349090.2920@woody.linux-foundation.org> (raw)
In-Reply-To: <alpine.LSU.1.00.0802112122300.3870@racer.site>
On Mon, 11 Feb 2008, Johannes Schindelin wrote:
>
> I mean, sometimes even 0.01% is worth showing.
I tried this, and no. It's not. Not even 0.1%. If you care at that level,
you're better off just looking at the diffstat itself. The noise factor
with the summary makes it useless with even 0.1%.
That said, the *reporting* sometimes looks better with tenths of percents.
This is an example of "report in tenths of percent, limit to 1%":
4.8% arch/um/include/
6.1% arch/um/os-Linux/drivers/
5.7% arch/um/os-Linux/include/
2.6% arch/um/os-Linux/skas/
1.7% arch/um/os-Linux/sys-i386/
9.2% arch/um/os-Linux/sys-x86_64/
69.6% arch/um/os-Linux/
and maybe that format would be nicer (and more "future proof" in case
people want to make the limiting go down to fractional percentages too).
If people want to play around with it, here's a trial patch (and yes, if
you want it down to 0.1%, you can use "--dirstat=0", and it will only
remove the ones that really round down to 0.0%, but it really isn't any
good for summaries any more).
For summaries, I'd suggest testing with something like
git diff --dirstat=? v2.6.23..v2.6.24
and comparing the 0% cutoff (pretty damn useless) to 1 (already *much*
better and perhaps appropriate as a "deep summary") to 2 (probably the
best if you actually want a short summary) to 3 (fairly similar, but
dropped a few "2.x%" cases that were relevant).
The 1% cutoff case is already big enough that I don't think it's good as a
summary, and while it contains "more information", it's actually likely
much more informative in that case to do the default 3% case, and then
noticing that "drivers" and "include" are pretty high, and at that point
it makes sense to say "ok, let's re-do it but limiting it to that
subdirectory", and do a
git diff --dirstat=3 v2.6.23..v2.6.24 drivers/
where now you'll actually see *more* information than for the 1% case, but
only as it pertains for that drivers subdirectory.
So I seriously doubt that you often want to have small percentages, and
that it's much more productive to give people the overview and then they
can "drill down" into that overview.
Anyway, here's the patch to try out..
Linus
---
diff.c | 11 ++++++++-----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/diff.c b/diff.c
--- a/diff.c
+++ b/diff.c
@@ -1012,10 +1012,13 @@ static long gather_dirstat(struct diffstat_dir *dir, unsigned long changed, cons
}
if (baselen) {
- int percent = this_dir * 100 / changed;
- if (percent >= dir->percent) {
- printf("%4d%% %.*s\n", percent, baselen, base);
- return 0;
+ int permille = this_dir * 1000 / changed;
+ if (permille) {
+ int percent = permille / 10;
+ if (percent >= dir->percent) {
+ printf("%4d.%01d%% %.*s\n", percent, permille % 10, baselen, base);
+ return 0;
+ }
}
}
return this_dir;
next prev parent reply other threads:[~2008-02-11 22:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-11 20:59 Add "--dirstat" for some directory statistics Linus Torvalds
2008-02-11 21:17 ` Linus Torvalds
2008-02-11 21:24 ` Johannes Schindelin
2008-02-11 21:41 ` Linus Torvalds
2008-02-11 22:06 ` Linus Torvalds [this message]
2008-02-11 22:25 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.1.00.0802111349090.2920@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox