* [PATCH] git-apply: Don't barf when --stat'ing a diff with no line changes.
@ 2005-06-21 15:14 Sven Verdoolaege
2005-06-21 15:36 ` Linus Torvalds
0 siblings, 1 reply; 2+ messages in thread
From: Sven Verdoolaege @ 2005-06-21 15:14 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
Diffs with only mode changes didn't pass through git-apply --stat.
E.g.,
sh-3.00$ cg-diff -p | cat
diff --git a/autogen.sh b/autogen.sh
old mode 100644
new mode 100755
diff --git a/cdd2polylib.pl b/cdd2polylib.pl
old mode 100644
new mode 100755
sh-3.00$ cg-diff -p | git-apply --stat
Floating point exception
sh-3.00$ cg-diff -p | ~/src/git-linus/git-apply --stat
autogen.sh | 0
cdd2polylib.pl | 0
2 files changed, 0 insertions(+), 0 deletions(-)
skimo
--
git-apply: Don't barf when --stat'ing a diff with no line changes.
---
commit 2c796d01298b7e5bb5518927bf85aa461603a5c5
tree f80d68da66ee8c2ec1d491ef92c95e49db2016cd
parent 0795495388d703dc84110a9a7917dd6ec9516bb4
author Sven Verdoolaege <skimo@liacs.nl> Tue, 21 Jun 2005 17:09:27 +0200
committer Sven Verdoolaege <skimo@liacs.nl> Tue, 21 Jun 2005 17:09:27 +0200
apply.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/apply.c b/apply.c
--- a/apply.c
+++ b/apply.c
@@ -751,9 +751,11 @@ static void show_stats(struct patch *pat
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);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] git-apply: Don't barf when --stat'ing a diff with no line changes.
2005-06-21 15:14 [PATCH] git-apply: Don't barf when --stat'ing a diff with no line changes Sven Verdoolaege
@ 2005-06-21 15:36 ` Linus Torvalds
0 siblings, 0 replies; 2+ messages in thread
From: Linus Torvalds @ 2005-06-21 15:36 UTC (permalink / raw)
To: Sven Verdoolaege; +Cc: git
On Tue, 21 Jun 2005, Sven Verdoolaege wrote:
>
> Diffs with only mode changes didn't pass through git-apply --stat.
Heh. On ppc64, "divw 0,0" apparently just silently produces 0, so I never
noticed. Thanks.
Linus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-06-21 15:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-21 15:14 [PATCH] git-apply: Don't barf when --stat'ing a diff with no line changes Sven Verdoolaege
2005-06-21 15:36 ` Linus Torvalds
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).