Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
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.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0102-summary.sh | 27 |
1 file changed, 27 insertions, 0 deletions
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</a>" 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 "<tr class=.branch.><td><a href=./remotes/log/?h=origin/topic.>origin/topic</a>" tmp && + test_grep "<option value=.origin/topic.>origin/topic</option>" tmp && + cgit_ok remotesrc "url=remotes/log/" >tmp && + test_grep "<a class=.remote-deco. href=./remotes/log/?id=$topic.>origin/topic</a>" tmp +' + +test_expect_success 'remote branches stay hidden by default' ' + cgit_ok noremotesrc "url=remotes/refs/" >tmp && + test_grep "<tr class=.branch.><td><a href=./remotes/log/.>master</a>" 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() { |
