{"thread":{"id":"1000","subject":"[PATCH] git-apply: Don't barf when --stat'ing a diff with no line changes.","startedAt":"2005-06-21T15:14:30Z","lastAt":"2005-06-21T15:36:37Z","messageCount":2,"participants":["Sven Verdoolaege","Linus Torvalds"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"5100","messageId":"20050621151430.GA26628@pc117b.liacs.nl","threadId":"1000","inReplyTo":null,"subject":"[PATCH] git-apply: Don't barf when --stat'ing a diff with no line changes.","fromName":"Sven Verdoolaege","fromEmail":"skimo@liacs.nl","sentAt":"2005-06-21T15:14:30Z","receivedAt":"2005-06-21T15:14:30Z","isPatch":true,"sender":{"key":"skimo@kotnet.org","avatar":null},"body":"Diffs with only mode changes didn't pass through git-apply --stat.\nE.g.,\n\nsh-3.00$ cg-diff -p | cat\ndiff --git a/autogen.sh b/autogen.sh\nold mode 100644\nnew mode 100755\ndiff --git a/cdd2polylib.pl b/cdd2polylib.pl\nold mode 100644\nnew mode 100755\nsh-3.00$ cg-diff -p | git-apply --stat\nFloating point exception\nsh-3.00$ cg-diff -p | ~/src/git-linus/git-apply --stat\n autogen.sh     |    0 \n cdd2polylib.pl |    0 \n 2 files changed, 0 insertions(+), 0 deletions(-)\n\nskimo\n--\ngit-apply: Don't barf when --stat'ing a diff with no line changes.\n\n---\ncommit 2c796d01298b7e5bb5518927bf85aa461603a5c5\ntree f80d68da66ee8c2ec1d491ef92c95e49db2016cd\nparent 0795495388d703dc84110a9a7917dd6ec9516bb4\nauthor Sven Verdoolaege <skimo@liacs.nl> Tue, 21 Jun 2005 17:09:27 +0200\ncommitter Sven Verdoolaege <skimo@liacs.nl> Tue, 21 Jun 2005 17:09:27 +0200\n\n apply.c |    8 +++++---\n 1 files changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/apply.c b/apply.c\n--- a/apply.c\n+++ b/apply.c\n@@ -751,9 +751,11 @@ static void show_stats(struct patch *pat\n \tdel = patch->lines_deleted;\n \ttotal = add + del;\n \n-\ttotal = (total * max + max_change / 2) / max_change;\n-\tadd = (add * max + max_change / 2) / max_change;\n-\tdel = total - add;\n+\tif (max_change > 0) {\n+\t\ttotal = (total * max + max_change / 2) / max_change;\n+\t\tadd = (add * max + max_change / 2) / max_change;\n+\t\tdel = total - add;\n+\t}\n \tprintf(\" %-*s |%5d %.*s%.*s\\n\",\n \t\tlen, name, patch->lines_added + patch->lines_deleted,\n \t\tadd, pluses, del, minuses);\n"},{"id":"5101","messageId":"Pine.LNX.4.58.0506210833140.2268@ppc970.osdl.org","threadId":"1000","inReplyTo":"20050621151430.GA26628@pc117b.liacs.nl","subject":"Re: [PATCH] git-apply: Don't barf when --stat'ing a diff with no line changes.","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-06-21T15:36:37Z","receivedAt":"2005-06-21T15:36:37Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 21 Jun 2005, Sven Verdoolaege wrote:\n>\n> Diffs with only mode changes didn't pass through git-apply --stat.\n\nHeh. On ppc64, \"divw 0,0\" apparently just silently produces 0, so I never \nnoticed. Thanks.\n\n\t\tLinus\n"}]}