From 39c9330857acd534b60d5c0d652926dd9741b56e Mon Sep 17 00:00:00 2001 From: Alexander Borsuk Date: Fri, 1 Jul 2022 01:42:15 +0200 Subject: [PATCH] Version script should use UTC dates instead of local ones Signed-off-by: Alexander Borsuk --- tools/unix/version.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/unix/version.sh b/tools/unix/version.sh index ff00d48539..23c40b05f0 100755 --- a/tools/unix/version.sh +++ b/tools/unix/version.sh @@ -7,7 +7,8 @@ set -euo pipefail # This approach counts a number of commits each day based on committer's commit date # instead of author's commit date, to avoid conflicts when old PRs are merged, but the # number of today's commits stays the same. -COUNT_AND_DATE=( $(git log --date=short --pretty=format:%cd --date=format:'%Y.%m.%d' --since="30 days ago" | sort | uniq -c | tail -1) ) +# Force git with TZ variable and local dates to print the UTC date. +COUNT_AND_DATE=( $(TZ=UTC0 git log --pretty=format:%cd --date=iso-local --since="30 days ago" | cut -d' ' -f 1 | sed 's/-/./g' | sort | uniq -c | tail -1) ) if [ -z "$COUNT_AND_DATE" ]; then # Fallback: use today's date if there were no commits since last month. COUNT_AND_DATE=( 0 $(date +%Y.%m.%d) )