From 89aa3c0d0a4c6d9885272602005975b763ea1604 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sat, 12 Apr 2008 15:53:53 +0200 Subject: Include diff in commit view Signed-off-by: Lars Hjemli --- ui-commit.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ui-commit.c') diff --git a/ui-commit.c b/ui-commit.c index 8019e36..c2fafd7 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -9,6 +9,7 @@ #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; @@ -218,10 +219,11 @@ void cgit_print_commit(char *hex) print_fileinfo(&items[i]); html(""); html("
"); - 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(")
"); } cgit_free_commitinfo(info); -- cgit v1.2.1 From 39912a24edf45497e668ebda25636aa6f6db0c9b Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sun, 13 Apr 2008 12:20:00 +0200 Subject: Remove 'patch' link from tab, add to commit view It's a bit confusing to enter the patch view from the tab, since it has no layout. And the commit view has always lacked showing the commit id. Both of these warts are fixed by this commit, which adds a new header line in the commit view which shows the commit id as a 'permalink' to the current commit and also adds a link to the patch view of the current commit. Signed-off-by: Lars Hjemli --- ui-commit.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ui-commit.c') diff --git a/ui-commit.c b/ui-commit.c index c2fafd7..dd36cc0 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -175,6 +175,12 @@ void cgit_print_commit(char *hex) html(""); cgit_print_date(info->committer_date, FMT_LONGDATE); html("\n"); + html("commit"); + tmp = sha1_to_hex(commit->object.sha1); + cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp); + html(" ("); + cgit_patch_link("patch", NULL, NULL, NULL, tmp); + html(")\n"); html("tree"); tmp = xstrdup(hex); cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL, -- cgit v1.2.1