X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/fb3655df3bf85bd405c5921bbd4b3a54c705c839..da218fcd9eb554a8405ca72e84bcc0feb371194f:/ui-refs.c diff --git a/ui-refs.c b/ui-refs.c index 3fbaad0..20c91e3 100644 --- a/ui-refs.c +++ b/ui-refs.c @@ -1,6 +1,6 @@ /* ui-refs.c: browse symbolic refs * - * Copyright (C) 2006 Lars Hjemli + * Copyright (C) 2006-2014 cgit Development Team * * Licensed under GNU General Public License v2 * (see COPYING for full license text) @@ -197,10 +197,9 @@ void cgit_print_branches(int maxcount) if (maxcount == 0 || maxcount > list.count) maxcount = list.count; - if (maxcount < list.count) { - qsort(list.refs, list.count, sizeof(*list.refs), cmp_branch_age); + qsort(list.refs, list.count, sizeof(*list.refs), cmp_branch_age); + if (ctx.repo->branch_sort == 0) qsort(list.refs, maxcount, sizeof(*list.refs), cmp_ref_name); - } for (i = 0; i < maxcount; i++) print_branch(list.refs[i]); @@ -241,9 +240,9 @@ void cgit_print_refs() html(""); - if (ctx.qry.path && !strncmp(ctx.qry.path, "heads", 5)) + if (ctx.qry.path && !prefixcmp(ctx.qry.path, "heads")) cgit_print_branches(0); - else if (ctx.qry.path && !strncmp(ctx.qry.path, "tags", 4)) + else if (ctx.qry.path && !prefixcmp(ctx.qry.path, "tags")) cgit_print_tags(0); else { cgit_print_branches(0);