author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Thu, 28 Sep 2006 15:37:39 +0000 (17:37 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Fri, 29 Sep 2006 05:32:53 +0000 (22:32 -0700) | ||
commit | 3ed74e608a69ce0f10bfad2e4ef6cf99eec04613 | |
tree | 97f0745f0717db4202a638f124fb8e756641d80d | tree | snapshot |
parent | 5c5b2ea9ab95f71ac155f12d75d1432b5c93c2bb | commit | diff |
diff --stat: ensure at least one '-' for deletions, and one '+' for additions
The number of '-' and '+' is still linear. The idea is that
scaled-length := floor(a * length + b) with the following constraints: if
length == 1, scaled-length == 1, and the combined length of plusses
and minusses should not be larger than the width by a small margin. Thus,
a + b == 1
and
a * max_plusses + b + a * max_minusses + b = width + 1
The solution is
a * x + b = ((width - 1) * (x - 1) + max_change - 1)
/ (max_change - 1)
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
The number of '-' and '+' is still linear. The idea is that
scaled-length := floor(a * length + b) with the following constraints: if
length == 1, scaled-length == 1, and the combined length of plusses
and minusses should not be larger than the width by a small margin. Thus,
a + b == 1
and
a * max_plusses + b + a * max_minusses + b = width + 1
The solution is
a * x + b = ((width - 1) * (x - 1) + max_change - 1)
/ (max_change - 1)
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
diff.c | diff | blob | history |