From 99233f7d61ba55427849c5ab692fa91eaad8bfb7 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 14:16:16 -0700 Subject: Ask each page that sorts odd branches in one loop --- tests/t0301-security.sh | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) (limited to 'tests/t0301-security.sh') diff --git a/tests/t0301-security.sh b/tests/t0301-security.sh index 73af518..01dd793 100755 --- a/tests/t0301-security.sh +++ b/tests/t0301-security.sh @@ -204,32 +204,17 @@ test_expect_success 'set up a repo whose branches point at odd objects' ' } >oddrefrc ' -test_expect_success 'refs page sorts such branches without crashing' ' - CGIT_CONFIG="$PWD/oddrefrc" QUERY_STRING="url=oddref/refs/" cgit >tmp && - grep "points-at-tree" tmp && - grep "" tmp -' - -test_expect_success 'the branch page sorts them without crashing' ' - CGIT_CONFIG="$PWD/oddrefrc" QUERY_STRING="url=oddref/refs/heads/" cgit >tmp && - grep "points-at-tree" tmp && - grep "" tmp -' - -test_expect_success 'the summary page sorts them without crashing' ' - CGIT_CONFIG="$PWD/oddrefrc" QUERY_STRING="url=oddref/" cgit >tmp && - grep "points-at-tree" tmp && - grep "" tmp +test_expect_success 'the refs, branch and summary pages sort such branches' ' + for page in refs/ refs/heads/ "" + do + CGIT_CONFIG="$PWD/oddrefrc" QUERY_STRING="url=oddref/$page" cgit >tmp && + grep "points-at-tree" tmp && + grep "" tmp || return 1 + done ' test_expect_success 'name-sorted branches are unaffected' ' - { - echo "virtual-root=/" && - echo "cache-size=0" && - echo "branch-sort=name" && - echo "repo.url=oddref" && - echo "repo.path=$PWD/repos/oddref/.git" - } >oddrefnamerc && + sed "s/^branch-sort=age$/branch-sort=name/" oddrefrc >oddrefnamerc && CGIT_CONFIG="$PWD/oddrefnamerc" QUERY_STRING="url=oddref/refs/heads/" cgit >tmp && grep "points-at-tree" tmp && grep "" tmp -- cgit