diff options
Diffstat (limited to 'third_party/cgit/ui-shared.c')
-rw-r--r-- | third_party/cgit/ui-shared.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/third_party/cgit/ui-shared.c b/third_party/cgit/ui-shared.c index af2176719902..7670276f4b1e 100644 --- a/third_party/cgit/ui-shared.c +++ b/third_party/cgit/ui-shared.c @@ -894,6 +894,15 @@ void cgit_add_clone_urls(void (*fn)(const char *)) add_clone_urls(fn, ctx.cfg.clone_prefix, ctx.repo->url); } +static int print_this_commit_option(void) +{ + struct object_id oid; + if (get_oid(ctx.qry.head, &oid)) + return 1; + html_option("this commit", oid_to_hex(&oid), ctx.qry.head); + return 0; +} + static int print_branch_option(const char *refname, const struct object_id *oid, int flags, void *cb_data) { @@ -999,9 +1008,12 @@ static void print_header(void) html("<form method='get'>\n"); cgit_add_hidden_formfields(0, 1, ctx.qry.page); html("<select name='h' onchange='this.form.submit();'>\n"); + print_this_commit_option(); + html("<optgroup label='branches'>"); for_each_branch_ref(print_branch_option, ctx.qry.head); if (ctx.repo->enable_remote_branches) for_each_remote_ref(print_branch_option, ctx.qry.head); + html("</optgroup>"); html("</select> "); html("<input type='submit' value='switch'/>"); html("</form>"); |