Commit 3a6b87604592c583079227ea995f50eb3ec74121

Christian Weisgerber 2021-08-31T19:18:37

use the POSIX-compliant "date -u" command to return UTC time; ok stsp

diff --git a/regress/cmdline/commit.sh b/regress/cmdline/commit.sh
index 4ea275e..cfed572 100755
--- a/regress/cmdline/commit.sh
+++ b/regress/cmdline/commit.sh
@@ -1399,7 +1399,7 @@ EOF
 	fi
 
 	local author_time=`git_show_author_time $testroot/repo`
-	d=`env TZ=UTC date -r $author_time +"%a %b %e %X %Y UTC"`
+	d=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
 	echo "-----------------------------------------------" > $testroot/stdout.expected
 	echo "commit $head_rev (master)" >> $testroot/stdout.expected
 	echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
@@ -1438,7 +1438,7 @@ EOF
 	fi
 
 	local author_time=`git_show_author_time $testroot/repo`
-	d=`env TZ=UTC date -r $author_time +"%a %b %e %X %Y UTC"`
+	d=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
 	echo "-----------------------------------------------" \
 		> $testroot/stdout.expected
 	echo "commit $head_rev (master)" >> $testroot/stdout.expected
diff --git a/regress/cmdline/histedit.sh b/regress/cmdline/histedit.sh
index 7de2767..94c4666 100755
--- a/regress/cmdline/histedit.sh
+++ b/regress/cmdline/histedit.sh
@@ -152,9 +152,9 @@ test_histedit_no_op() {
 
 	# We should have a backup of old commits
 	(cd $testroot/repo && got histedit -l > $testroot/stdout)
-	d_orig2=`env TZ=UTC date -r $old_author_time2 +"%a %b %e %X %Y UTC"`
-	d_new2=`env TZ=UTC date -r $new_author_time2 +"%G-%m-%d"`
-	d_orig=`env TZ=UTC date -r $orig_author_time +"%G-%m-%d"`
+	d_orig2=`date -u -r $old_author_time2 +"%a %b %e %X %Y UTC"`
+	d_new2=`date -u -r $new_author_time2 +"%G-%m-%d"`
+	d_orig=`date -u -r $orig_author_time +"%G-%m-%d"`
 	cat > $testroot/stdout.expected <<EOF
 -----------------------------------------------
 commit $old_commit2 (formerly master)
diff --git a/regress/cmdline/rebase.sh b/regress/cmdline/rebase.sh
index adcd68a..a3608c6 100755
--- a/regress/cmdline/rebase.sh
+++ b/regress/cmdline/rebase.sh
@@ -153,9 +153,9 @@ test_rebase_basic() {
 
 	# We should have a backup of old commits
 	(cd $testroot/repo && got rebase -l > $testroot/stdout)
-	d_orig2=`env TZ=UTC date -r $orig_author_time2 +"%a %b %e %X %Y UTC"`
-	d_new2=`env TZ=UTC date -r $new_author_time2 +"%G-%m-%d"`
-	d_0=`env TZ=UTC date -r $commit0_author_time +"%G-%m-%d"`
+	d_orig2=`date -u -r $orig_author_time2 +"%a %b %e %X %Y UTC"`
+	d_new2=`date -u -r $new_author_time2 +"%G-%m-%d"`
+	d_0=`date -u -r $commit0_author_time +"%G-%m-%d"`
 	cat > $testroot/stdout.expected <<EOF
 -----------------------------------------------
 commit $orig_commit2 (formerly newbranch)
diff --git a/regress/cmdline/tag.sh b/regress/cmdline/tag.sh
index 8710f96..fdc7ff8 100755
--- a/regress/cmdline/tag.sh
+++ b/regress/cmdline/tag.sh
@@ -137,11 +137,11 @@ test_tag_list() {
 	tag_id=`got ref -r $testroot/repo -l \
 		| grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
 	local tagger_time=`git_show_tagger_time $testroot/repo $tag`
-	d1=`env TZ=UTC date -r $tagger_time +"%a %b %e %X %Y UTC"`
+	d1=`date -u -r $tagger_time +"%a %b %e %X %Y UTC"`
 	tag_id2=`got ref -r $testroot/repo -l \
 		| grep "^refs/tags/$tag2" | tr -d ' ' | cut -d: -f2`
 	local tagger_time2=`git_show_tagger_time $testroot/repo $tag2`
-	d2=`env TZ=UTC date -r $tagger_time2 +"%a %b %e %X %Y UTC"`
+	d2=`date -u -r $tagger_time2 +"%a %b %e %X %Y UTC"`
 
 	got tag -r $testroot/repo -l > $testroot/stdout
 
@@ -184,11 +184,11 @@ test_tag_list_lightweight() {
 	tag_id=`got ref -r $testroot/repo -l \
 		| grep "^refs/tags/$tag" | tr -d ' ' | cut -d: -f2`
 	local tagger_time=`git_show_author_time $testroot/repo $tag`
-	d1=`env TZ=UTC date -r $tagger_time +"%a %b %e %X %Y UTC"`
+	d1=`date -u -r $tagger_time +"%a %b %e %X %Y UTC"`
 	tag_id2=`got ref -r $testroot/repo -l \
 		| grep "^refs/tags/$tag2" | tr -d ' ' | cut -d: -f2`
 	local tagger_time2=`git_show_author_time $testroot/repo $tag2`
-	d2=`env TZ=UTC date -r $tagger_time2 +"%a %b %e %X %Y UTC"`
+	d2=`date -u -r $tagger_time2 +"%a %b %e %X %Y UTC"`
 
 	got tag -r $testroot/repo -l > $testroot/stdout