Re: diff --stat
- From
Jeff King <peff@peff.net>
- Date
- Feb 14, 2012, 21:53 UTC
- Message-ID
- <20120214215318.GA24802@sigill.intra.peff.net>
- In-Reply-To
- <7vty2t5bmw.fsf@alter.siamese.dyndns.org>
On Tue, Feb 14, 2012 at 01:49:11PM -0800, Junio C Hamano wrote:
Show 17 quoted lines
> static int scale_linear(int it, int width, int max_change)
> {
> + if (!it)
> + return 0;
> /*
> - * make sure that at least one '-' is printed if there were deletions,
> - * and likewise for '+'.
> + * make sure that at least one '-' or '+' is printed if
> + * there is any change to this path. The easiest way is to
> + * scale linearly as if all the quantities were one smaller
> + * than they actually are, and then add one to the result.
> */
> if (max_change < 2)
> - return it;
> - return ((it - 1) * (width - 1) + max_change - 1) / (max_change - 1);
> + return 1;
> + return 1 + ((it - 1) * (width - 1) / (max_change - 1));I'm not sure I understand why the "it - 1" and "max_change - 1" bits are still there, or what they are doing in the first place. I.e., why is it not simply "scale linearly to width-1, then add 1" as I posted earlier?
-Peff