From 0584725e08215fbbe951cec7eacd7dc2a839ccc2 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 17:45:52 -1000 Subject: Move the odd dates test to the dates tests The notes test had borrowed its repository, so it now builds one. --- tests/t0203-dates.sh | 34 ++++++++++++++++++++++++++++++++ tests/t0303-robustness.sh | 50 +++++++++-------------------------------------- 2 files changed, 43 insertions(+), 41 deletions(-) (limited to 'tests') diff --git a/tests/t0203-dates.sh b/tests/t0203-dates.sh index 36b11df..5d4d72d 100755 --- a/tests/t0203-dates.sh +++ b/tests/t0203-dates.sh @@ -177,4 +177,38 @@ test_expect_success 'a date in a listing stays on one line' ' grep "^ white-space: nowrap;$" rule ' +# 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/odd && + ( + cd repos/odd && + test_commit base && + c=$(git rev-parse HEAD) && + t=$(printf "object %s\\ntype commit\\ntag early\\ntagger E 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 9223372036854775808 +0000\\ncommitter A 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 1700000000 -2147483648\\ncommitter A 1700000000 +99999999999\\n\\nzone\\n" $tree | + git hash-object -t commit -w --literally --stdin) && + git update-ref refs/heads/zone $zone + ) && + cgitrc_repo oddrc odd && + for q in "url=odd/" "url=odd/refs/" "url=odd/tag/&h=early" \ + "url=odd/log/&h=far" "url=odd/commit/&h=far" "url=odd/commit/&h=zone" \ + "url=odd/atom/&h=far" + do + cgit_rc oddrc "$q" >tmp 2>err && + grep "^Status: 200" tmp && + ! grep "Unable to complete" tmp && + ! grep "Timestamp" err || return 1 + done && + cgit_rc oddrc "url=odd/commit/&h=far" >tmp && + grep "1970-01-01" tmp +' + test_done diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index 016b2de..1301f5c 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -810,54 +810,22 @@ test_expect_success 'the error page does not resolve the id it refused' ' test_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 - ) && - cgitrc_repo datesrc dates && - 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_rc datesrc "$q" >tmp 2>err && - grep "^Status: 200" tmp && - ! grep "Unable to complete" tmp && - ! grep "Timestamp" err || return 1 - done && - cgit_rc datesrc "url=dates/commit/&h=far" >tmp && - grep "1970-01-01" tmp -' - # A notes ref a pusher pointed at something other than a tree made git die on # loading it, which took every page of the repository down with it. test_expect_success 'a notes ref that names no tree is passed over' ' - blob=$(echo not-a-tree | git -C repos/dates hash-object -w --stdin) && - git -C repos/dates update-ref refs/notes/commits $blob && - git -C repos/dates update-ref refs/notes/signatures/tar $blob && - cgitrc_repo notesrc dates snapshots=tar && - for q in "url=dates/" "url=dates/log/" "url=dates/refs/" "url=dates/tree/" + test_create_repo repos/notes && + test_commit -C repos/notes base && + blob=$(echo not-a-tree | git -C repos/notes hash-object -w --stdin) && + git -C repos/notes update-ref refs/notes/commits $blob && + git -C repos/notes update-ref refs/notes/signatures/tar $blob && + cgitrc_repo notesrc notes snapshots=tar && + for q in "url=notes/" "url=notes/log/" "url=notes/refs/" "url=notes/tree/" do cgit_ok notesrc "$q" >tmp || return 1 done && - cgit_rc notesrc "url=dates/snapshot/dates-base.tar.asc" >tmp 2>err && + cgit_rc notesrc "url=notes/snapshot/notes-base.tar.asc" >tmp 2>err && test_grep "^Status: 404" tmp && - test_grep "<div class=.error.>No signature for dates-base.tar</div>" tmp && + test_grep "<div class=.error.>No signature for notes-base.tar</div>" tmp && test_grep ! "notes tree" err ' -- cgit 2.12.1