From c358aa3dfebf4fc1f3005dd960aa5c1c020eed76 Mon Sep 17 00:00:00 2001 From: Ragnar Ouchterlony Date: Mon, 14 Sep 2009 20:19:02 +0200 Subject: Add possibility to switch between unidiff and side-by-side-diff. A new config option side-by-side-diffs added, defaulting to 0, meaning unidiff. Also a query option (ss) is used toggle this. In the commit page you can switch between the two diff formats by clicking on the link on the "commit"-row, to the right of (patch). In the diff page you can switch by using the link at the start of the page. All commit-links and diff-links will remember the choice. Signed-off-by: Ragnar Ouchterlony Signed-off-by: Lars Hjemli --- ui-commit.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'ui-commit.c') diff --git a/ui-commit.c b/ui-commit.c index f5b0ae5..b5e3c01 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -58,9 +58,14 @@ void cgit_print_commit(char *hex) html("\n"); html("commit"); tmp = sha1_to_hex(commit->object.sha1); - cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp); + cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, 0); html(" ("); cgit_patch_link("patch", NULL, NULL, NULL, tmp); + html(") ("); + if ((ctx.qry.ssdiff && !ctx.cfg.ssdiff) || (!ctx.qry.ssdiff && ctx.cfg.ssdiff)) + cgit_commit_link("unidiff", NULL, NULL, ctx.qry.head, tmp, 1); + else + cgit_commit_link("side-by-side diff", NULL, NULL, ctx.qry.head, tmp, 1); html(")\n"); html("tree"); tmp = xstrdup(hex); @@ -78,10 +83,10 @@ void cgit_print_commit(char *hex) html("parent" ""); cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL, - ctx.qry.head, sha1_to_hex(p->item->object.sha1)); + ctx.qry.head, sha1_to_hex(p->item->object.sha1), 0); html(" ("); cgit_diff_link("diff", NULL, NULL, ctx.qry.head, hex, - sha1_to_hex(p->item->object.sha1), NULL); + sha1_to_hex(p->item->object.sha1), NULL, 0); html(")"); parents++; } -- cgit v1.2.3-70-g09d2