diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Clean up the whole tree
Diffstat (limited to '')
-rw-r--r--source/ui-commit.c42
1 file changed, 15 insertions, 27 deletions
diff --git a/source/ui-commit.c b/source/ui-commit.c
index a35fcec..6055509 100644
--- a/source/ui-commit.c
+++ b/source/ui-commit.c
@@ -23,8 +23,8 @@
// many parents or more is shown without a diff at all.
#define OCTOPUS_PARENTS 3
-static void print_ident_row(const char *role, const char *name,
- const char *email, timestamp_t date, int tz)
+static void print_ident_row(const char *role, const char *name, const char *email,
+ timestamp_t date, int tz)
{
htmlf("<tr><th>%s</th><td>", role);
cgit_open_filter(ctx.repo->email_filter, email, "commit");
@@ -41,8 +41,7 @@ static void print_ident_row(const char *role, const char *name,
html("</time></td></tr>\n");
}
-static int print_parent_rows(struct commit *commit, const char *rev,
- const char *prefix)
+static int print_parent_rows(struct commit *commit, const char *rev, const char *prefix)
{
struct commit_list *p;
struct commit *parent;
@@ -50,24 +49,20 @@ static int print_parent_rows(struct commit *commit, const char *rev,
int parents = 0;
for (p = commit->parents; p; p = p->next) {
- parent = lookup_commit_reference(the_repository,
- &p->item->object.oid);
+ parent = lookup_commit_reference(the_repository, &p->item->object.oid);
if (!parent) {
html("<tr><td colspan='3'>");
cgit_print_error("Error reading parent commit");
html("</td></tr>\n");
continue;
}
- html("<tr><th>parent</th>"
- "<td colspan='2' class='oid'>");
+ html("<tr><th>parent</th><td colspan='2' class='oid'>");
parent_hex = label = oid_to_hex(&p->item->object.oid);
if (ctx.repo->enable_subject_links)
label = cgit_parse_commit(parent)->subject;
- cgit_commit_link(label, NULL, NULL, ctx.qry.head, parent_hex,
- prefix);
+ cgit_commit_link(label, NULL, NULL, ctx.qry.head, parent_hex, prefix);
html(" (");
- cgit_diff_link("diff", NULL, NULL, ctx.qry.head, rev,
- oid_to_hex(&p->item->object.oid), prefix);
+ cgit_diff_link("diff", NULL, NULL, ctx.qry.head, rev, oid_to_hex(&p->item->object.oid), prefix);
html(")</td></tr>\n");
parents++;
}
@@ -95,14 +90,12 @@ void cgit_print_commit(char *hex, const char *prefix)
hex = ctx.qry.head;
if (repo_get_oid(the_repository, hex, &oid)) {
- cgit_print_error_page(400, "Bad Request",
- "Bad object id: %s", hex);
+ cgit_print_error_page(400, "Bad Request", "Bad object id: %s", hex);
return;
}
commit = lookup_commit_reference(the_repository, &oid);
if (!commit) {
- cgit_print_error_page(404, "Not Found",
- "Bad commit reference: %s", hex);
+ cgit_print_error_page(404, "Not Found", "Bad commit reference: %s", hex);
return;
}
info = cgit_parse_commit(commit);
@@ -116,15 +109,13 @@ void cgit_print_commit(char *hex, const char *prefix)
cgit_print_diff_ctrls();
html("<table class='commit-info'>\n");
- print_ident_row("author", info->author, info->author_email,
- info->author_date, info->author_tz);
+ print_ident_row("author", info->author, info->author_email, info->author_date, info->author_tz);
print_ident_row("committer", info->committer, info->committer_email,
- info->committer_date, info->committer_tz);
+ info->committer_date, info->committer_tz);
html("<tr><th>commit</th><td colspan='2' class='oid'>");
commit_hex = oid_to_hex(&commit->object.oid);
- cgit_commit_link(commit_hex, NULL, NULL, ctx.qry.head, commit_hex,
- prefix);
+ cgit_commit_link(commit_hex, NULL, NULL, ctx.qry.head, commit_hex, prefix);
html(" (");
cgit_patch_link("patch", NULL, NULL, NULL, commit_hex, prefix);
html(")</td></tr>\n");
@@ -135,12 +126,10 @@ void cgit_print_commit(char *hex, const char *prefix)
html("<tr><th>tree</th><td colspan='2' class='oid'>");
tree_rev = xstrdup(hex);
- cgit_tree_link(oid_to_hex(get_commit_tree_oid(commit)), NULL, NULL,
- ctx.qry.head, tree_rev, NULL);
+ cgit_tree_link(oid_to_hex(get_commit_tree_oid(commit)), NULL, NULL, ctx.qry.head, tree_rev, NULL);
if (prefix) {
html(" /");
- cgit_tree_link(prefix, NULL, NULL, ctx.qry.head, tree_rev,
- prefix);
+ cgit_tree_link(prefix, NULL, NULL, ctx.qry.head, tree_rev, prefix);
}
free(tree_rev);
html("</td></tr>\n");
@@ -169,8 +158,7 @@ void cgit_print_commit(char *hex, const char *prefix)
if (parents < OCTOPUS_PARENTS) {
if (parents)
- first_parent =
- oid_to_hex(&commit->parents->item->object.oid);
+ first_parent = oid_to_hex(&commit->parents->item->object.oid);
else
first_parent = NULL;
cgit_print_diff(ctx.qry.oid, first_parent, prefix, 0, 0);