diff options
Diffstat (limited to 'tests')
-rwxr-xr-xtests/t0303-robustness.sh39
1 file changed, 39 insertions, 0 deletions
diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh
index 05237c6..3cd49ed 100755
--- a/tests/t0303-robustness.sh
+++ b/tests/t0303-robustness.sh
@@ -796,4 +796,43 @@ test_expect_success 'the error page does not resolve the id it refused' '
! grep "<title>.* @ " tmp
'
+# A pushed date or zone outside what git's date code accepts used to end the
+# summary, refs and log pages inside git. Each is now shown as the epoch or
+# as UTC, the way git's own log shows them.
+test_expect_success 'odd dates and zones in pushed objects render' '
+ test_create_repo repos/dates &&
+ (
+ cd repos/dates &&
+ test_commit base &&
+ c=$(git rev-parse HEAD) &&
+ t=$(printf "object %s\\ntype commit\\ntag early\\ntagger E <e@x> 1 -0100\\n\\nearly\\n" $c |
+ git hash-object -t tag -w --stdin) &&
+ git update-ref refs/tags/early $t &&
+ tree=$(git rev-parse HEAD^{tree}) &&
+ far=$(printf "tree %s\\nauthor A <a@x> 9223372036854775808 +0000\\ncommitter A <a@x> 9223372036854775808 +0000\\n\\nfar\\n" $tree |
+ git hash-object -t commit -w --literally --stdin) &&
+ git update-ref refs/heads/far $far &&
+ zone=$(printf "tree %s\\nauthor A <a@x> 1700000000 -2147483648\\ncommitter A <a@x> 1700000000 +99999999999\\n\\nzone\\n" $tree |
+ git hash-object -t commit -w --literally --stdin) &&
+ git update-ref refs/heads/zone $zone
+ ) &&
+ {
+ echo "virtual-root=/" &&
+ echo "cache-size=0" &&
+ echo "repo.url=dates" &&
+ echo "repo.path=$PWD/repos/dates/.git"
+ } >datesrc &&
+ for q in "url=dates/" "url=dates/refs/" "url=dates/tag/&h=early" \
+ "url=dates/log/&h=far" "url=dates/commit/&h=far" "url=dates/commit/&h=zone" \
+ "url=dates/atom/&h=far"
+ do
+ CGIT_CONFIG="$PWD/datesrc" QUERY_STRING="$q" cgit >tmp 2>err &&
+ grep "^Status: 200" tmp &&
+ ! grep "Unable to complete" tmp &&
+ ! grep "Timestamp" err || return 1
+ done &&
+ CGIT_CONFIG="$PWD/datesrc" QUERY_STRING="url=dates/commit/&h=far" cgit >tmp &&
+ grep "1970-01-01" tmp
+'
+
test_done