From d3aa4c43edb0e3d385a13a9915ea96bc55c22b06 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 17 Oct 2026 17:09:14 -1000 Subject: Show an odd pushed date rather than die on it A date past what the system holds, a zone that is no hhmm offset, or a date earlier than its own westward offset all made git die inside show_date, which took the summary, refs, log, commit and feed pages of the repository down. They are now clamped as git's own log clamps them. --- tests/t0303-robustness.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'tests') 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 ".* @ " 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 -- cgit