From 615563459f42a18e271a60be2c475fdaa027242d Mon Sep 17 00:00:00 2001 From: Michael Robinson Date: Tue, 17 Sep 2024 15:39:48 +0100 Subject: [PATCH] Fix stats for situation where there are no inserts / deletes --- git-quick-stats | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/git-quick-stats b/git-quick-stats index 1286f95..b232cfb 100755 --- a/git-quick-stats +++ b/git-quick-stats @@ -337,11 +337,15 @@ function detailedGitStats() { if(more["total"] > 0) { printf "\t insertions: %d\t(%.0f%%)\n", more[author], \ (more[author] / more["total"] * 100) + } else { + printf "\t insertions: %d\t(%.0f%%)\n", 0, 0 } if(less["total"] > 0) { printf "\t deletions: %d\t(%.0f%%)\n", less[author], \ (less[author] / less["total"] * 100) + } else { + printf "\t deletions: %d\t(%.0f%%)\n", 0, 0 } if(file["total"] > 0) { @@ -498,11 +502,15 @@ function csvOutput() { if(more["total"] > 0) { printf "%d,%.0f%%,", more[author], \ (more[author] / more["total"] * 100) + } else { + printf "0,0%%," } if(less["total"] > 0) { printf "%d,%.0f%%,", less[author], \ (less[author] / less["total"] * 100) + } else { + printf "0,0%%," } if(file["total"] > 0) {