Re: BUG? in --dirstat when rearranging lines in a file

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: BUG? in --dirstat when rearranging lines in a file

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:51:00

Linus Torvalds [off-list ref] writes:
That said, honestly, for dirstat, the big issue was that it made it
really really simple. Look at how small the dirstat patch was (commit
7df7c019c2a4), and realize that it's because it just re-used the
existing damage counting code.
Yes, the most of the logic added by the patch is to percolate the damage
point up the tree to either coalesce or filter the result into manageable
size.

Speaking of that logic, I've been wondering for about a year and a half if
this "if (permille)" exclusion was intentional:

	/*
	 * We don't report dirstat's for
	 *  - the top level
	 *  - or cases where everything came from a single directory
	 *    under this directory (sources == 1).
	 */
	if (baselen && sources != 1) {
		int permille = this_dir * 1000 / changed;
		if (permille) {
			int percent = permille / 10;
			if (percent >= dir->percent) {
				fprintf(opt->file, "%s%4d.%01d%% %.*s\n", line_prefix,
					percent, permille % 10, baselen, base);
				if (!dir->cumulative)
					return 0;
			}
		}
	}

If the user sets dir->percent to zero, with an expectation that it will
disable all filtering, shouldn't we show everything?

Re: BUG? in --dirstat when rearranging lines in a file

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:51:00

On Thu, Apr 7, 2011 at 3:43 PM, Junio C Hamano [off-list ref] wrote:
Speaking of that logic, I've been wondering for about a year and a half if
this "if (permille)" exclusion was intentional:

If the user sets dir->percent to zero, with an expectation that it will
disable all filtering, shouldn't we show everything?
Hmm. My gut feel is that you still don't want to see directories with
no changes. In fact, doesn't the whole "avoid even diffing identical
directories with the same SHA1" logic end up meaning that even if you
were to disable filtering, you'd _still_ not show the 0% case?

But hey, I dunno. If you want the semantics to be "not identical, but
not damaged enough to be even 0.1%, so show it", I don't think that
would be _wrong_ per se. I just don't think our current "ignore 0.0%
files" is wrong either ;)

                           Linus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help