X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/bf8293d3196d49d6c4a48b254a04415183ca2762..ed3497b0de6634350cd17b320538fba918d4084c:/ui-commit.c diff --git a/ui-commit.c b/ui-commit.c index 2b4f677..aa1892f 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -1,12 +1,13 @@ /* ui-commit.c: generate commit view * - * 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) */ #include "cgit.h" +#include "ui-commit.h" #include "html.h" #include "ui-shared.h" #include "ui-diff.h" @@ -26,20 +27,21 @@ void cgit_print_commit(char *hex, const char *prefix) hex = ctx.qry.head; if (get_sha1(hex, sha1)) { - cgit_print_error(fmt("Bad object id: %s", hex)); + cgit_print_error("Bad object id: %s", hex); return; } commit = lookup_commit_reference(sha1); if (!commit) { - cgit_print_error(fmt("Bad commit reference: %s", hex)); + cgit_print_error("Bad commit reference: %s", hex); return; } info = cgit_parse_commit(commit); - format_note(NULL, sha1, ¬es, PAGE_ENCODING, 0); + format_display_notes(sha1, ¬es, PAGE_ENCODING, 0); load_ref_decorations(DECORATE_FULL_REFS); + cgit_print_diff_ctrls(); html("\n"); html("\n"); html("\n"); - for (p = commit->parents; p ; p = p->next) { + for (p = commit->parents; p; p = p->next) { parent = lookup_commit_reference(p->item->object.sha1); if (!parent) { html("
author"); html_txt(info->author); @@ -64,11 +66,6 @@ void cgit_print_commit(char *hex, const char *prefix) cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, prefix, 0); html(" ("); cgit_patch_link("patch", NULL, NULL, NULL, tmp, prefix); - html(") ("); - if ((ctx.qry.ssdiff && !ctx.cfg.ssdiff) || (!ctx.qry.ssdiff && ctx.cfg.ssdiff)) - cgit_commit_link("unidiff", NULL, NULL, ctx.qry.head, tmp, prefix, 1); - else - cgit_commit_link("side-by-side diff", NULL, NULL, ctx.qry.head, tmp, prefix, 1); html(")
tree"); tmp = xstrdup(hex); @@ -78,8 +75,9 @@ void cgit_print_commit(char *hex, const char *prefix) html(" /"); cgit_tree_link(prefix, NULL, NULL, ctx.qry.head, tmp, prefix); } + free(tmp); html("
"); @@ -139,7 +137,7 @@ void cgit_print_commit(char *hex, const char *prefix) tmp = sha1_to_hex(commit->parents->item->object.sha1); else tmp = NULL; - cgit_print_diff(ctx.qry.sha1, tmp, prefix); + cgit_print_diff(ctx.qry.sha1, tmp, prefix, 0, 0); } strbuf_release(¬es); cgit_free_commitinfo(info);