about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ui-shared.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c index a295102..dd312bb 100644 --- a/ui-shared.c +++ b/ui-shared.c
@@ -893,6 +893,15 @@ void cgit_add_clone_urls(void (*fn)(const char *))
893 add_clone_urls(fn, ctx.cfg.clone_prefix, ctx.repo->url); 893 add_clone_urls(fn, ctx.cfg.clone_prefix, ctx.repo->url);
894} 894}
895 895
896static int print_this_commit_option(void)
897{
898 struct object_id oid;
899 if (get_oid(ctx.qry.head, &oid))
900 return 1;
901 html_option(oid_to_hex(&oid), "this commit", ctx.qry.head);
902 return 0;
903}
904
896static int print_branch_option(const char *refname, const struct object_id *oid, 905static int print_branch_option(const char *refname, const struct object_id *oid,
897 int flags, void *cb_data) 906 int flags, void *cb_data)
898{ 907{
@@ -1000,9 +1009,12 @@ static void print_header(void)
1000 html("<form method='get'>\n"); 1009 html("<form method='get'>\n");
1001 cgit_add_hidden_formfields(0, 1, ctx.qry.page); 1010 cgit_add_hidden_formfields(0, 1, ctx.qry.page);
1002 html("<select name='h' onchange='this.form.submit();'>\n"); 1011 html("<select name='h' onchange='this.form.submit();'>\n");
1012 print_this_commit_option();
1013 html("<optgroup label='branches'>");
1003 for_each_branch_ref(print_branch_option, ctx.qry.head); 1014 for_each_branch_ref(print_branch_option, ctx.qry.head);
1004 if (ctx.repo->enable_remote_branches) 1015 if (ctx.repo->enable_remote_branches)
1005 for_each_remote_ref(print_branch_option, ctx.qry.head); 1016 for_each_remote_ref(print_branch_option, ctx.qry.head);
1017 html("</optgroup>");
1006 html("</select> "); 1018 html("</select> ");
1007 html("<input type='submit' value='switch'/>"); 1019 html("<input type='submit' value='switch'/>");
1008 html("</form>"); 1020 html("</form>");