Re: [RFC/PATCH 5/3] Alternative --dirstat implementation, based on diffstat analysis
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 12, 2011, 22:22 UTC
- Message-ID
- <7vr597nm86.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <201104130003.02869.johan@herland.net>
Johan Herland <johan@herland.net> writes:
> So, how should we count binary files in the diffstat version of > --dirstat?
IIRC, the reason Linus used the "change" (not "lines") damage computation in dirstat was exactly for this reason.
Comparing and combining the damage as number of lines and changed bytes simply does not make much sense, so my gut answer to this question is "we shouldn't". The --numstat mode punts exactly for this reason, to avoid tempting people to add numbers up without thinking and getting nonsense results.
I suspect that any heuristics is as good as your divide-by-64; you probably could run count_lines(one->data, one->size) in the text diff codepath in builtin_diffstat() to keep a running average of the line lengths of the files involved, but I do not think it is worth it.