author | Lars Hjemli <hjemli@gmail.com> | 2008-04-12 13:53:53 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-04-12 18:00:40 (UTC) |
commit | 89aa3c0d0a4c6d9885272602005975b763ea1604 (patch) (side-by-side diff) | |
tree | 4527f91c87d65426e5cd72b1d3e9da2d37ceb6d3 | |
parent | f135569b2be3fb1816f802f9a162b3743b735d1c (diff) | |
download | cgit-89aa3c0d0a4c6d9885272602005975b763ea1604.zip cgit-89aa3c0d0a4c6d9885272602005975b763ea1604.tar.gz cgit-89aa3c0d0a4c6d9885272602005975b763ea1604.tar.bz2 |
Include diff in commit view
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-commit.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ui-commit.c b/ui-commit.c index 8019e36..c2fafd7 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -1,27 +1,28 @@ /* ui-commit.c: generate commit view * * Copyright (C) 2006 Lars Hjemli * * Licensed under GNU General Public License v2 * (see COPYING for full license text) */ #include "cgit.h" #include "html.h" #include "ui-shared.h" +#include "ui-diff.h" static int files, slots; static int total_adds, total_rems, max_changes; static int lines_added, lines_removed; static char *curr_rev; static struct fileinfo { char status; unsigned char old_sha1[20]; unsigned char new_sha1[20]; unsigned short old_mode; unsigned short new_mode; char *old_path; char *new_path; unsigned int added; unsigned int removed; @@ -205,24 +206,25 @@ void cgit_print_commit(char *hex) html("</table>\n"); html("<div class='commit-subject'>"); html_txt(info->subject); html("</div>"); html("<div class='commit-msg'>"); html_txt(info->msg); html("</div>"); if (!(commit->parents && commit->parents->next && commit->parents->next->next)) { html("<div class='diffstat-header'>Diffstat</div>"); html("<table summary='diffstat' class='diffstat'>"); max_changes = 0; cgit_diff_commit(commit, inspect_filepair); for(i = 0; i<files; i++) print_fileinfo(&items[i]); html("</table>"); html("<div class='diffstat-summary'>"); - htmlf("%d files changed, %d insertions, %d deletions (", + htmlf("%d files changed, %d insertions, %d deletions", files, total_adds, total_rems); - cgit_diff_link("show diff", NULL, NULL, ctx.qry.head, hex, - NULL, NULL); + cgit_print_diff(ctx.qry.sha1, + sha1_to_hex(commit->parents->item->object.sha1), + NULL); html(")</div>"); } cgit_free_commitinfo(info); } |