diff options
| -rw-r--r-- | source/ui-shared.c | 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -rwxr-xr-x | tests/t0303-robustness.sh | 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2 files changed, 11 insertions, 0 deletions
diff --git a/source/ui-shared.c b/source/ui-shared.c index 147472e..3970c58 100644 --- a/source/ui-shared.c +++ b/source/ui-shared.c @@ -480,6 +480,10 @@ static int print_branch_option(const struct reference *ref, void *data) // The switcher runs on every page, so it is bounded like the refs list. if (ctx.cfg.max_ref_count && opt->count >= ctx.cfg.max_ref_count) return -1; + // A name spelled like an option is refused as a head, so offering it + // would only lead to an error page. + if (name[0] == '-') + return 0; opt->count++; html_option(name, name, opt->selected); return 0; diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index 5bdb060..55a83c3 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -382,6 +382,13 @@ test_expect_success 'the fallback branch skips a name spelled like an option' ' grep "^Status: 200" tmp ' +# Such a branch is refused as a head, so the switcher must not offer a +# choice that can only lead to an error page. +test_expect_success 'the branch switcher leaves out a name spelled like an option' ' + grep "<option value=.master." tmp && + ! grep "<option value=.-first." tmp +' + test_expect_success 'a blank line in the mimetype file is skipped' ' ( cd repos/rob && |
