From 84f4caf0456f806445052e1b507e4051e25e0788 Mon Sep 17 00:00:00 2001 From: arzzen Date: Sun, 22 Jan 2017 13:35:44 +0100 Subject: [PATCH] awk division by zero #16 --- git-quick-stats | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/git-quick-stats b/git-quick-stats index 97d87fe..4d98ba5 100755 --- a/git-quick-stats +++ b/git-quick-stats @@ -46,7 +46,10 @@ function detailedGitStats() { printf "\t insertions: %d (%.0f%%)\n", more[author], (more[author] / more["total"] * 100) printf "\t deletions: %d (%.0f%%)\n", less[author], (less[author] / less["total"] * 100) printf "\t files: %d (%.0f%%)\n", file[author], (file[author] / file["total"] * 100) - printf "\t commits: %d (%.0f%%)\n", commits[author], (commits[author] / commits["total"] * 100) + + if(commits["total"] > 0) { + printf "\t commits: %d (%.0f%%)\n", commits[author], (commits[author] / commits["total"] * 100) + } if ( first[author] != "" ) { printf "\t first commit: %s\n", first[author]