1 /* ui-summary.c: functions for generating repo summary page
3 * Copyright (C) 2006 Lars Hjemli
5 * Licensed under GNU General Public License v2
6 * (see COPYING for full license text)
11 static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1,
12 int flags, void *cb_data)
14 struct commit *commit;
15 struct commitinfo *info;
18 commit = lookup_commit(sha1);
19 if (commit && !parse_commit(commit)){
20 info = cgit_parse_commit(commit);
22 url = cgit_pageurl(cgit_query_repo, "log",
23 fmt("h=%s", refname));
24 html_link_open(url, NULL, NULL);
25 strncpy(buf, refname, sizeof(buf));
29 cgit_print_date(commit->date);
31 url = cgit_pageurl(cgit_query_repo, "commit", fmt("id=%s", sha1_to_hex(sha1)));
32 html_link_open(url, NULL, NULL);
33 html_txt(info->subject);
36 html_txt(info->author);
38 cgit_free_commitinfo(info);
43 htmlf("*** bad ref %s", sha1_to_hex(sha1));
49 static void cgit_print_branches()
51 html("<table class='list'>");
52 html("<tr><th class='left'>Branch</th><th class='left'>Updated</th><th class='left'>Commit subject</th><th class='left'>Author</th></tr>\n");
53 for_each_branch_ref(cgit_print_branch_cb, NULL);
57 void cgit_print_summary()
60 html_txt("Repo summary page");
62 cgit_print_branches();