diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Leave a branch spelled like an option out of the switcher
Such a name is refused as a head before git could read it as an option, and the fallback branch already skips it, so the switcher offered a choice that led only to an error page.
Diffstat (limited to 'source')
-rw-r--r--source/ui-shared.c4
1 file changed, 4 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;