aboutsummaryrefslogtreecommitdiff
path: root/apply.c
diff options
context:
space:
mode:
authorSven Verdoolaege <skimo@liacs.nl>2005-06-21 17:14:30 +0200
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-21 08:41:56 -0700
commit69f956e10484f92f9e0ab191b668c79d697b9f0f (patch)
treef80d68da66ee8c2ec1d491ef92c95e49db2016cd /apply.c
parent0795495388d703dc84110a9a7917dd6ec9516bb4 (diff)
downloadgit-69f956e10484f92f9e0ab191b668c79d697b9f0f.tar.gz
git-69f956e10484f92f9e0ab191b668c79d697b9f0f.tar.xz
[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>
Diffstat (limited to 'apply.c')
-rw-r--r--apply.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/apply.c b/apply.c
index 7d9059ba9..8a3ead6c9 100644
--- a/apply.c
+++ b/apply.c
@@ -751,9 +751,11 @@ static void show_stats(struct patch *patch)
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;
+ if (max_change > 0) {
+ 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);