From 8080e24abbac1346aabd94a50820a98d4b8b00d2 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 11:49:20 -1000 Subject: Test the switcher on a page pinned to a commit --- tests/t0103-log.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/t0103-log.sh b/tests/t0103-log.sh index 16fc6e9..8cab0f5 100755 --- a/tests/t0103-log.sh +++ b/tests/t0103-log.sh @@ -50,6 +50,18 @@ test_expect_success 'a branch head keeps its plain option' ' test_grep ! "detached" tmp ' +# A page pinned to a commit by id lists that commit in the switcher, selected +# in place of the branch it was reached from. +test_expect_success 'a pinned commit is selected in place of its branch' ' + sha=$(git -C repos/foo rev-parse master~1) && + cgit_ok_url "foo/commit&id=$sha" >tmp && + selected_options tmp >selected && + test_line_count = 1 selected && + short=$(echo "$sha" | cut -c1-10) && + test_grep "option value=.$sha. selected>$short (detached)<" selected && + test_grep "" tmp +' + test_expect_success 'a search escapes the space in its links' ' cgit_ok_url "with+space/log&qt=grep&q=commit+1" >tmp && test_grep "/with%20space/log/?qt=grep" tmp && -- cgit 2.12.1