From d61c812247f8f500dfc0c53c90d5caeeea0a8283 Mon Sep 17 00:00:00 2001 From: Tom Ice Date: Sun, 31 Aug 2025 16:22:59 -0400 Subject: [PATCH] Flatten arrays for wider awk compatibility * The current implementation of the calendar heatmap by author contains multidimensional arrays. This works with newer versions of awk, but can cause issues with systems that use an older variant which cannot easily handle these calculations. macOS is especially impacted by this. By flattening the arrays from a multidimensional array to a single dimensional array, we can maintain greater compatibility across awk variants without requiring the user to install additional versions of awk. Addresses issue #194 --- git-quick-stats | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git-quick-stats b/git-quick-stats index 0422707..042aa40 100755 --- a/git-quick-stats +++ b/git-quick-stats @@ -138,7 +138,7 @@ function commitsCalendarByAuthor() { cmd | getline weekday; close(cmd); # weekday: 1=Mon, ..., 7=Sun - count[weekday][mon]++; + count[weekday * 12 + mon]++; } END { # Output matrix @@ -151,7 +151,7 @@ function commitsCalendarByAuthor() { else if (d==6) printf "Sat "; else if (d==7) printf "Sun "; for (m=1; m<=12; m++) { - c = count[d][m]+0; + c = count[d * 12 + m]+0; if (c==0) out="..."; else if (c<=9)