From efcd03690973820c8c75a1b153a11d3e9f4bdafd Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 11:40:59 -1000 Subject: Test remote branches shown and hidden enable-remote-branches had no test anywhere, so the branch list, the switcher or the log label could each stop honouring it unnoticed. --- tests/t0102-summary.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/t0102-summary.sh b/tests/t0102-summary.sh index 104da68..819e9ec 100755 --- a/tests/t0102-summary.sh +++ b/tests/t0102-summary.sh @@ -89,6 +89,33 @@ test_expect_success 'an empty clone url draws no clone heading' ' grep "https://example.org/cloned" tmp ' +# A remote-tracking branch is shown only when enable-remote-branches asks for +# it, in the branch list, in the switcher and as a label in the log. +test_expect_success 'set up a repository with a remote-tracking branch' ' + mkrepo repos/remotes 2 && + git -C repos/remotes update-ref refs/remotes/origin/topic HEAD~1 && + cgitrc_repo remotesrc remotes repo.enable-remote-branches=1 && + cgitrc_repo noremotesrc remotes +' + +test_expect_success 'remote branches are shown when enabled' ' + topic=$(git -C repos/remotes rev-parse origin/topic) && + cgit_ok remotesrc "url=remotes/refs/" >tmp && + test_grep "origin/topic" tmp && + test_grep "" tmp && + cgit_ok remotesrc "url=remotes/log/" >tmp && + test_grep "origin/topic" tmp +' + +test_expect_success 'remote branches stay hidden by default' ' + cgit_ok noremotesrc "url=remotes/refs/" >tmp && + test_grep "master" tmp && + test_grep ! "origin/topic" tmp && + cgit_ok noremotesrc "url=remotes/log/" >tmp && + test_grep ">commit 1<" tmp && + test_grep ! "origin/topic" tmp +' + # Prints how many columns each row of the page's list table spans, one row to # a line, counting a cell without a colspan as one. row_widths() { -- cgit 2.12.1