Commit Diff


commit - 8d6e02ca3fa611d074d94e362086f8dff48b8f3d
commit + 1c72bab5d11d2f52b471a33a23614dc19deab730
blob - 3d48fd3967ec94a3096d042e38e36f52a695c6a0
blob + 719bac3298df1e16197cba688737ead5ea2508cd
--- regress/cmdline/blame.sh
+++ regress/cmdline/blame.sh
@@ -65,7 +65,7 @@ test_blame_basic() {
 	local short_commit2=`trim_obj_id 32 $commit2`
 	local short_commit3=`trim_obj_id 32 $commit3`
 
-	d=`date -u -d "@$author_time" +"%G-%m-%d"`
+	d=`date -u -r $author_time +"%G-%m-%d"`
 	echo "1) $short_commit1 $d $GOT_AUTHOR_8 1" > $testroot/stdout.expected
 	echo "2) $short_commit2 $d $GOT_AUTHOR_8 2" >> $testroot/stdout.expected
 	echo "3) $short_commit3 $d $GOT_AUTHOR_8 3" >> $testroot/stdout.expected
@@ -113,7 +113,7 @@ test_blame_tag() {
 	local short_commit1=`trim_obj_id 32 $commit1`
 	local short_commit2=`trim_obj_id 32 $commit2`
 
-	d=`date -u -d "@$author_time" +"%G-%m-%d"`
+	d=`date -u -r $author_time +"%G-%m-%d"`
 	echo "1) $short_commit1 $d $GOT_AUTHOR_8 1" > $testroot/stdout.expected
 	echo "2) $short_commit2 $d $GOT_AUTHOR_8 2" >> $testroot/stdout.expected
 
@@ -149,7 +149,7 @@ test_blame_file_single_line() {
 
 	local short_commit1=`trim_obj_id 32 $commit1`
 
-	d=`date -u -d "@$author_time" +"%G-%m-%d"`
+	d=`date -u -r $author_time +"%G-%m-%d"`
 	echo "1) $short_commit1 $d $GOT_AUTHOR_8 1" > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
@@ -184,7 +184,7 @@ test_blame_file_single_line_no_newline() {
 
 	local short_commit1=`trim_obj_id 32 $commit1`
 
-	d=`date -u -d "@$author_time" +"%G-%m-%d"`
+	d=`date -u -r $author_time +"%G-%m-%d"`
 	echo "1) $short_commit1 $d $GOT_AUTHOR_8 1" > $testroot/stdout.expected
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
@@ -213,7 +213,7 @@ test_blame_all_lines_replaced() {
 
 	(cd $testroot/wt && got blame alpha > $testroot/stdout)
 
-	d=`date -u -d "@$author_time" +"%G-%m-%d"`
+	d=`date -u -r $author_time +"%G-%m-%d"`
 	echo "1) $short_commit1 $d $GOT_AUTHOR_8 1" > $testroot/stdout.expected
 	echo "2) $short_commit1 $d $GOT_AUTHOR_8 2" >> $testroot/stdout.expected
 	echo "3) $short_commit1 $d $GOT_AUTHOR_8 3" >> $testroot/stdout.expected
@@ -265,7 +265,7 @@ test_blame_lines_shifted_up() {
 
 	(cd $testroot/wt && got blame alpha > $testroot/stdout)
 
-	d=`date -u -d "@$author_time" +"%G-%m-%d"`
+	d=`date -u -r $author_time +"%G-%m-%d"`
 	echo "1) $short_commit1 $d $GOT_AUTHOR_8 1" > $testroot/stdout.expected
 	echo "2) $short_commit1 $d $GOT_AUTHOR_8 2" >> $testroot/stdout.expected
 	echo "3) $short_commit3 $d $GOT_AUTHOR_8 foo" >> $testroot/stdout.expected
@@ -321,7 +321,7 @@ test_blame_lines_shifted_down() {
 
 	(cd $testroot/wt && got blame alpha > $testroot/stdout)
 
-	d=`date -u -d "@$author_time" +"%G-%m-%d"`
+	d=`date -u -r $author_time +"%G-%m-%d"`
 	echo "01) $short_commit1 $d $GOT_AUTHOR_8 1" \
 		> $testroot/stdout.expected
 	echo "02) $short_commit1 $d $GOT_AUTHOR_8 2" \
@@ -394,7 +394,7 @@ EOF
 	local commit1=`git_show_head $testroot/repo`
 	local short_commit1=`trim_obj_id 32 $commit1`
 	local author_time1=`git_show_author_time $testroot/repo`
-	local d1=`date -u -d "@$author_time1" +"%G-%m-%d"`
+	local d1=`date -u -r $author_time1 +"%G-%m-%d"`
 
 	cat > $testroot/wt/alpha <<EOF
 SUBDIRS = ext modules codedocs docs
@@ -421,7 +421,7 @@ EOF
 	local commit2=`git_show_head $testroot/repo`
 	local short_commit2=`trim_obj_id 32 $commit2`
 	local author_time2=`git_show_author_time $testroot/repo`
-	local d2=`date -u -d "@$author_time2" +"%G-%m-%d"`
+	local d2=`date -u -r $author_time2 +"%G-%m-%d"`
 
 	cat > $testroot/wt/alpha <<EOF
 SUBDIRS = ext modules pdns codedocs docs
@@ -445,7 +445,7 @@ EOF
 	local commit3=`git_show_head $testroot/repo`
 	local short_commit3=`trim_obj_id 32 $commit3`
 	local author_time3=`git_show_author_time $testroot/repo`
-	local d3=`date -u -d "@$author_time3" +"%G-%m-%d"`
+	local d3=`date -u -r $author_time3 +"%G-%m-%d"`
 
 	cat > $testroot/wt/alpha <<EOF
 SUBDIRS = ext modules pdns codedocs docs
@@ -469,7 +469,7 @@ EOF
 	local commit4=`git_show_head $testroot/repo`
 	local short_commit4=`trim_obj_id 32 $commit4`
 	local author_time4=`git_show_author_time $testroot/repo`
-	local d4=`date -u -d "@$author_time4" +"%G-%m-%d"`
+	local d4=`date -u -r $author_time4 +"%G-%m-%d"`
 
 	(cd $testroot/wt && got blame alpha > $testroot/stdout)
 
@@ -718,7 +718,7 @@ test_blame_added_on_branch() {
 	local short_commit2=`trim_obj_id 32 $commit2`
 	local short_commit3=`trim_obj_id 32 $commit3`
 
-	d=`date -u -d "@$author_time" +"%G-%m-%d"`
+	d=`date -u -r $author_time +"%G-%m-%d"`
 	echo "1) $short_commit1 $d $GOT_AUTHOR_8 1" > $testroot/stdout.expected
 	echo "2) $short_commit2 $d $GOT_AUTHOR_8 2" >> $testroot/stdout.expected
 	echo "3) $short_commit3 $d $GOT_AUTHOR_8 3" >> $testroot/stdout.expected
@@ -789,7 +789,7 @@ test_blame_symlink() {
 		return 1
 	fi
 
-	d=`date -u -d "@$author_time" +"%G-%m-%d"`
+	d=`date -u -r $author_time +"%G-%m-%d"`
 	echo "1) $short_commit0 $d $GOT_AUTHOR_8 alpha" \
 		> $testroot/stdout.expected
 
@@ -810,7 +810,7 @@ test_blame_symlink() {
 		return 1
 	fi
 
-	d=`date -u -d "@$author_time" +"%G-%m-%d"`
+	d=`date -u -r $author_time +"%G-%m-%d"`
 	echo "1) $short_commit0 $d $GOT_AUTHOR_8 beta" \
 		> $testroot/stdout.expected
 
@@ -959,7 +959,7 @@ EOF
 
 	(cd $testroot/wt && got blame alpha > $testroot/stdout)
 
-	d=`date -u -d "@$author_time" +"%G-%m-%d"`
+	d=`date -u -r $author_time +"%G-%m-%d"`
 	echo "1) $short_commit5 $d $GOT_AUTHOR_8 X" > $testroot/stdout.expected
 	echo "2) $short_commit1 $d $GOT_AUTHOR_8 A" >> $testroot/stdout.expected
 	echo "3) $short_commit1 $d $GOT_AUTHOR_8 B" >> $testroot/stdout.expected
blob - 124831d9fa1220a2799140cb081d095a318e4b5e
blob + c8ab494cfea92b7310366f4291dd97e862663b4b
--- regress/cmdline/commit.sh
+++ regress/cmdline/commit.sh
@@ -1617,7 +1617,7 @@ EOF
 	local author_time=`git_show_author_time $testroot/repo`
 	local prev_LC_TIME="$LC_TIME"
 	export LC_TIME=C
-	d=`date -u -d "@$author_time" +"%a %b %e %X %Y UTC"`
+	d=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
 	LC_TIME="$prev_LC_TIME"
 	echo "-----------------------------------------------" > $testroot/stdout.expected
 	echo "commit $head_rev (master)" >> $testroot/stdout.expected
@@ -1659,7 +1659,7 @@ EOF
 	local author_time=`git_show_author_time $testroot/repo`
 	local prev_LC_TIME="$LC_TIME"
 	export LC_TIME=C
-	d=`date -u -d "@$author_time" +"%a %b %e %X %Y UTC"`
+	d=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
 	LC_TIME="$prev_LC_TIME"
 	echo "-----------------------------------------------" \
 		> $testroot/stdout.expected
blob - 7897a7e13c5efe5e42d7cafe4794e1e3ab0ce5b2
blob + 473f0cbbff46cfc9956105e30e007792516993d8
--- regress/cmdline/common.sh
+++ regress/cmdline/common.sh
@@ -38,7 +38,7 @@ export MALLOC_OPTIONS=S
 # commands are used.
 [ -z "$PLATFORM" -a "$(uname)" = "Linux" ] && PLATFORM="linux"
 
-date()
+[ "$(date -u -r 86400 +%F 2>/dev/null)" = 1970-01-02 ] || date()
 {
 	DATECMD="date"
 	[ "$PLATFORM" != "linux" ] && {
@@ -48,7 +48,17 @@ date()
 			echo "Couldn't find gdate is GNU coreutils installed?"
 		}
 	}
-	command "$DATECMD" "$@"
+
+	local flag r u
+	while getopts r:u flag; do
+		case $flag in
+		r)	r=$OPTARG ;;
+		u)	u=-u ;;
+		?)	exit 1 ;;
+		esac
+	done
+	shift $((OPTIND - 1))
+	command "$DATECMD" $u ${r+-d"@$r"} "$@"
 }
 
 sed()
blob - a2f15eebb25a5cb8f1f524fcda7e9545a66598bf
blob + a28c22fe55ef65ffb5ea21159dd2527f7fdecb10
--- regress/cmdline/histedit.sh
+++ regress/cmdline/histedit.sh
@@ -153,14 +153,14 @@ test_histedit_no_op() {
 
 	# We should have a backup of old commits
 	(cd $testroot/repo && got histedit -l > $testroot/stdout)
-	d_orig1=`date -u -d "@$old_author_time1" +"%G-%m-%d"`
+	d_orig1=`date -u -r $old_author_time1 +"%G-%m-%d"`
 
 	local prev_LC_TIME="$LC_TIME"
 	export LC_TIME=C
-	d_orig2=`date -u -d "@$old_author_time2" +"%a %b %e %X %Y UTC"`
+	d_orig2=`date -u -r $old_author_time2 +"%a %b %e %X %Y UTC"`
 	export LC_TIME="$prev_LC_TIME"
-	d_new2=`date -u -d "@$new_author_time2" +"%G-%m-%d"`
-	d_orig=`date -u -d "@$orig_author_time" +"%G-%m-%d"`
+	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)
blob - 9a8e7225e281580ca6a615bebc015c247f281f49
blob + aa6a545fe216654b76ca23bbe186211d313c59a2
--- regress/cmdline/log.sh
+++ regress/cmdline/log.sh
@@ -319,9 +319,9 @@ no" > /dev/null)
 	local commit_id2=`git_show_head $testroot/repo`
 	local author_time2=`git_show_author_time $testroot/repo`
 
-	d=`date -u -d "@${author_time1}" +"%G-%m-%d"`
+	d=`date -u -r $author_time1 +"%G-%m-%d"`
 	printf "$d %-7s test oneline\n" master > $testroot/stdout.expected
-	d=`date -u -d "@${author_time2}" +"%G-%m-%d"`
+	d=`date -u -r $author_time2 +"%G-%m-%d"`
 	printf "$d %.7s test oneline\n" $commit_id1 >> $testroot/stdout.expected
 
 	(cd $testroot/repo && got log -s | head -n 2 > $testroot/stdout)
blob - 076ea66b61f236b000343e68fc3d1b761ac0b442
blob + 3dae9846af1f48ed12ad622a7be5ae5d83ac020d
--- regress/cmdline/rebase.sh
+++ regress/cmdline/rebase.sh
@@ -155,10 +155,10 @@ test_rebase_basic() {
 	(cd $testroot/repo && got rebase -l > $testroot/stdout)
 	local prev_LC_TIME="$LC_TIME"
 	export LC_TIME=C
-	d_orig2=`date -u -d "@$orig_author_time2" +"%a %b %e %X %Y UTC"`
+	d_orig2=`date -u -r $orig_author_time2 +"%a %b %e %X %Y UTC"`
 	export LC_TIME="$prev_LC_TIME"
-	d_new2=`date -u -d "@$new_author_time2" +"%G-%m-%d"`
-	d_0=`date -u -d "@$commit0_author_time" +"%G-%m-%d"`
+	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)
blob - d81b04d9a95f8ff34160c87f92d9bd2fa3dc56df
blob + 5b906ad72591e8ef4c113cf62280778bfc4897ce
--- regress/cmdline/tag.sh
+++ regress/cmdline/tag.sh
@@ -154,7 +154,7 @@ test_tag_list() {
 	
 	local prev_LC_TIME=$LC_TIME
 	export LC_TIME=C
-	d1=`date -u -d "@$tagger_time" +"%a %b %e %X %Y UTC"`
+	d1=`date -u -r $tagger_time +"%a %b %e %X %Y UTC"`
 	LC_TIME="$prev_LC_TIME"
 
 	tag_id2=`got ref -r $testroot/repo -l \
@@ -163,7 +163,7 @@ test_tag_list() {
 	
 	prev_LC_TIME="$LC_TIME"
 	export LC_TIME=C
-	d2=`date -u -d "@$tagger_time2" +"%a %b %e %X %Y UTC"`
+	d2=`date -u -r $tagger_time2 +"%a %b %e %X %Y UTC"`
 	LC_TIME="$prev_LC_TIME"
 
 	got tag -r $testroot/repo -l > $testroot/stdout
@@ -247,14 +247,14 @@ test_tag_list_lightweight() {
 	local tagger_time=`git_show_author_time $testroot/repo $tag`
 	local prev_LC_TIME=$LC_TIME
 	export LC_TIME=C
-	d1=`date -u -d "@$tagger_time" +"%a %b %e %X %Y UTC"`
+	d1=`date -u -r $tagger_time +"%a %b %e %X %Y UTC"`
 	LC_TIME="$prev_LC_TIME"
 	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`
 	
 	export LC_TIME=C
-	d2=`date -u -d "@$tagger_time2" +"%a %b %e %X %Y UTC"`
+	d2=`date -u -r $tagger_time2 +"%a %b %e %X %Y UTC"`
 	LC_TIME="$prev_LC_TIME"
 
 	got tag -r $testroot/repo -l > $testroot/stdout