Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
git-apply --stat: limit lines to 79 characters
author
Linus Torvalds
<torvalds@ppc970.osdl.org>
Wed, 1 Jun 2005 03:50:49 +0000
(20:50 -0700)
committer
Linus Torvalds
<torvalds@ppc970.osdl.org>
Wed, 1 Jun 2005 03:50:49 +0000
(20:50 -0700)
It had already tried to do that, but with the independent
rounding of the number of '+' and '-' characters, it would
sometimes do 80-char lines after all.
apply.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
6620498
)
diff --git
a/apply.c
b/apply.c
index dba8292267abe48b6f671315a3366d28b33fe0e3..e0a1549022ef4ad027c2dae369615bb4c2aec796 100644
(file)
--- a/
apply.c
+++ b/
apply.c
@@
-699,7
+699,7
@@
const char minuses[]= "---------------------------------------------------------
static void show_stats(struct patch *patch)
{
char *name = patch->old_name;
static void show_stats(struct patch *patch)
{
char *name = patch->old_name;
- int len, max, add, del;
+ int len, max, add, del
, total
;
if (!name)
name = patch->new_name;
if (!name)
name = patch->new_name;
@@
-721,9
+721,14
@@
static void show_stats(struct patch *patch)
max = max_change;
if (max + len > 70)
max = 70 - len;
max = max_change;
if (max + len > 70)
max = 70 - len;
-
- add = (patch->lines_added * max + max_change/2) / max_change;
- del = (patch->lines_deleted * max + max_change/2) / max_change;
+
+ add = patch->lines_added;
+ del = patch->lines_deleted;
+ total = add + del;
+
+ total = (total * max + max_change / 2) / max_change;
+ add = (add * max + max_change / 2) / max_change;
+ del = total - add;
printf(" %-*s |%5d %.*s%.*s\n",
len, name, patch->lines_added + patch->lines_deleted,
add, pluses, del, minuses);
printf(" %-*s |%5d %.*s%.*s\n",
len, name, patch->lines_added + patch->lines_deleted,
add, pluses, del, minuses);