git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Ericsson <ae@op5.se>
To: Junio C Hamano <junkio@cox.net>
Cc: Martin Waitz <tali@admingilde.org>, git@vger.kernel.org
Subject: Re: [PATCH 3/3] diff --stat: sometimes use non-linear scaling.
Date: Fri, 29 Sep 2006 12:56:05 +0200	[thread overview]
Message-ID: <451CFBC5.3020006@op5.se> (raw)
In-Reply-To: <7v64f8xs7p.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano wrote:
> Martin Waitz <tali@admingilde.org> writes:
> 
>>> It should at least never be superlinear, I believe.
>> So if we want to keep the logarithmic scale we can do some maths:
>> ...
>> But only I have not succeeded in solving these equations, I always stop
>> at the last invariant :-(
> 
> There is another constraint you did not mention.  Here is the
> output from my another failed experiment:
> 
>  .gitignore                       |    1 -
>  Documentation/git-tar-tree.txt   |    3 +++
>  Documentation/git-upload-tar.txt |   39 -----------------------------
>  Documentation/git.txt            |    4 ----
>  Makefile                         |    1 -
>  builtin-tar-tree.c               |  130 +++++++++++++++-----------------------
>  builtin-upload-tar.c             |   74 ----------------------------------
>  git.c                            |    1 -
>  8 files changed, 53 insertions(+), 200 deletions(-)
> 
> The deletion from Documentation/git-upload-tar.txt looks much
> larger than addition to builtin-tar-tree.c in the above, but
> there are 50 lines added to builtin-tar-tree.c (which is why
> this experiment is a failure).
> 
> Because we are dealing with non-linear scaling, the total of
> scaled adds and scaled deletes does not equal to scaled total.
> We can deal with this in two ways.  Scale the total and
> distribute it, or scale adds and deletes individually and make
> sure the sum of scaled adds and deletes never exceed the width.
> Obviously the former is easier to implement but it was _wrong_.
> 
> The fitting algorithm in the posted patch scales the total to
> fit the alloted width and then distributes the result to adds
> and deletes.
> 

Why not just take the stupid and simple solution and make it:

file1   | +31,-19    +++
file2   | +19,-106   ---
file3   | +10,-10    ###

That is, show the number of lines that actually changed, and print a 
fixed number of plusses or minuses after the numbers to make it easy to, 
at a glance, check if more lines were added than deleted or vice versa.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

  reply	other threads:[~2006-09-29 10:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-27  2:40 [PATCH 3/3] diff --stat: sometimes use non-linear scaling Junio C Hamano
2006-09-27  3:11 ` David Rientjes
2006-09-27  5:09   ` Junio C Hamano
2006-09-27  5:32     ` David Rientjes
2006-09-27  6:19       ` Junio C Hamano
2006-09-27  6:49         ` David Rientjes
2006-09-27  7:05           ` Junio C Hamano
2006-09-27  7:19             ` David Rientjes
2006-09-27  7:50               ` Johannes Schindelin
     [not found]                 ` <BAYC1-PASMTP024D1DA4730F9DF93F857FAE1A0@CEZ.ICE>
2006-09-27  8:35                   ` Johannes Schindelin
     [not found]                     ` <20060927044112.cc170405.seanlkml@sympatico.ca>
2006-09-27  8:41                       ` Sean
2006-10-06 15:53                 ` Petr Baudis
2006-09-27  7:36 ` Johannes Schindelin
2006-09-27  9:16 ` Martin Waitz
2006-09-27 15:12 ` Linus Torvalds
2006-09-28  8:17   ` Martin Waitz
2006-09-28  9:20     ` Junio C Hamano
2006-09-29 10:56       ` Andreas Ericsson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-10-12 15:04 apodtele

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=451CFBC5.3020006@op5.se \
    --to=ae@op5.se \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=tali@admingilde.org \
    /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;
as well as URLs for NNTP newsgroup(s).