diff options
Diffstat (limited to 'source/ui-refs.c')
| -rw-r--r-- | source/ui-refs.c | 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 28 insertions, 19 deletions
diff --git a/source/ui-refs.c b/source/ui-refs.c index c375137..d89e3ea 100644 --- a/source/ui-refs.c +++ b/source/ui-refs.c @@ -16,11 +16,9 @@ #include "ui-refs.h" #include "ui-shared.h" -/* - * The slice of a sorted ref list that one page shows, with end one past the - * last row. size is what a full page holds, so it also decides whether the - * list needs a pager. - */ +// The slice of a sorted ref list that one page shows, with end one past the +// last row. size is what a full page holds, so it also decides whether the +// list needs a pager. struct ref_page { int size; int start; @@ -80,10 +78,12 @@ static void collect_branches(struct reflist *list) static void print_branch_header(void) { - html("<tr class='nohover'><th class='left'>Branch</th>" - "<th class='left'>Commit message</th>" - "<th class='left col-author'>Author</th>" - "<th colspan='2' class='left'>Age</th></tr>\n"); + html( + "<tr class='nohover'><th class='left'>Branch</th>" + "<th class='left'>Commit message</th>" + "<th class='left col-author'>Author</th>" + "<th colspan='2' class='left'>Age</th></tr>\n" + ); } static int print_branch(struct refinfo *ref) @@ -100,7 +100,10 @@ static int print_branch(struct refinfo *ref) if (ref->object->type == OBJ_COMMIT) { cgit_commit_link(info->subject, NULL, NULL, name, NULL, NULL); html("</td><td class='col-author'>"); - cgit_open_filter(ctx.repo->email_filter, info->author_email, "refs"); + // A filter must not be handed a NULL argument. + cgit_open_filter( + ctx.repo->email_filter, info->author_email ? info->author_email : "", "refs" + ); html_txt(info->author); cgit_close_filter(ctx.repo->email_filter); html("</td><td colspan='2'>"); @@ -124,10 +127,12 @@ static void collect_tags(struct reflist *list) static void print_tag_header(void) { - html("<tr class='nohover'><th class='left'>Tag</th>" - "<th class='left'>Download</th>" - "<th class='left col-author'>Author</th>" - "<th colspan='2' class='left'>Age</th></tr>\n"); + html( + "<tr class='nohover'><th class='left'>Tag</th>" + "<th class='left'>Download</th>" + "<th class='left col-author'>Author</th>" + "<th colspan='2' class='left'>Age</th></tr>\n" + ); } static int print_tag(struct refinfo *ref) @@ -162,7 +167,10 @@ static int print_tag(struct refinfo *ref) cgit_close_filter(ctx.repo->email_filter); } } else if (ref->object->type == OBJ_COMMIT) { - cgit_open_filter(ctx.repo->email_filter, ref->commit->author_email, "refs"); + cgit_open_filter( + ctx.repo->email_filter, ref->commit->author_email ? ref->commit->author_email : "", + "refs" + ); html_txt(ref->commit->author); cgit_close_filter(ctx.repo->email_filter); } @@ -201,7 +209,8 @@ static void print_ref_pager(int ofs, int pagesize, int count, const char *path) } htmlf("%d - %d of %d", ofs + 1, ofs + pagesize < count ? ofs + pagesize : count, count); if (ofs + pagesize < count) { - url = cgit_pageurl(ctx.qry.repo, cgit_fmt("refs/%s", path), cgit_fmt("ofs=%d", ofs + pagesize)); + url = cgit_pageurl(ctx.qry.repo, cgit_fmt("refs/%s", path), + cgit_fmt("ofs=%d", ofs + pagesize)); html(" <a href='"); html_attr(url); html("'>[next]</a>"); @@ -328,11 +337,11 @@ void cgit_print_refs(void) cgit_print_layout_start(); html("<table class='list'>\n"); - if (ctx.qry.path && starts_with(ctx.qry.path, "heads")) + if (ctx.qry.path && starts_with(ctx.qry.path, "heads")) { print_branches_page(ctx.cfg.max_ref_count); - else if (ctx.qry.path && starts_with(ctx.qry.path, "tags")) + } else if (ctx.qry.path && starts_with(ctx.qry.path, "tags")) { print_tags_page(ctx.cfg.max_ref_count); - else { + } else { cgit_print_branches(ctx.cfg.max_ref_count); html("<tr class='nohover'><td colspan='5'></td></tr>\n"); cgit_print_tags(ctx.cfg.max_ref_count); |
