mirror of
https://git.zx2c4.com/cgit
synced 2025-06-21 01:25:46 +02:00
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 <ragnar@lysator.liu.se> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This commit is contained in:
parent
40e174d536
commit
c358aa3dfe
9 changed files with 73 additions and 16 deletions
11
ui-commit.c
11
ui-commit.c
|
@ -58,9 +58,14 @@ void cgit_print_commit(char *hex)
|
|||
html("</td></tr>\n");
|
||||
html("<tr><th>commit</th><td colspan='2' class='sha1'>");
|
||||
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(")</td></tr>\n");
|
||||
html("<tr><th>tree</th><td colspan='2' class='sha1'>");
|
||||
tmp = xstrdup(hex);
|
||||
|
@ -78,10 +83,10 @@ void cgit_print_commit(char *hex)
|
|||
html("<tr><th>parent</th>"
|
||||
"<td colspan='2' class='sha1'>");
|
||||
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(")</td></tr>");
|
||||
parents++;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue