mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
[PATCH] git-apply: Don't barf when --stat'ing a diff with no line changes.
Diffs with only mode changes didn't pass through git-apply --stat. [ Linus' note: they did for me, on my ppc64, where division by zero just silently returns zero. Duh. ] Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
0795495388
commit
69f956e104
8
apply.c
8
apply.c
|
@ -751,9 +751,11 @@ static void show_stats(struct patch *patch)
|
||||||
del = patch->lines_deleted;
|
del = patch->lines_deleted;
|
||||||
total = add + del;
|
total = add + del;
|
||||||
|
|
||||||
total = (total * max + max_change / 2) / max_change;
|
if (max_change > 0) {
|
||||||
add = (add * max + max_change / 2) / max_change;
|
total = (total * max + max_change / 2) / max_change;
|
||||||
del = total - add;
|
add = (add * max + max_change / 2) / max_change;
|
||||||
|
del = total - add;
|
||||||
|
}
|
||||||
printf(" %-*s |%5d %.*s%.*s\n",
|
printf(" %-*s |%5d %.*s%.*s\n",
|
||||||
len, name, patch->lines_added + patch->lines_deleted,
|
len, name, patch->lines_added + patch->lines_deleted,
|
||||||
add, pluses, del, minuses);
|
add, pluses, del, minuses);
|
||||||
|
|
Loading…
Reference in a new issue