From b9e3ea6a1b3a5fa9a2c2ec8cf9e15870261d9221 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sun, 1 Nov 2026 15:27:07 -1000 Subject: Keep the range in a large diff's patch link The link named only id, so for a diff between two commits it led to a patch of the newer one alone, and without an id it lost the branch as well and led to the default branch's tip. --- source/ui-shared.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'source/ui-shared.c') diff --git a/source/ui-shared.c b/source/ui-shared.c index 0eeda44..0865ffa 100644 --- a/source/ui-shared.c +++ b/source/ui-shared.c @@ -605,7 +605,7 @@ static void self_link(const char *name, const char *title, const char *class) else if (!strcmp(ctx.qry.page, "commit")) cgit_commit_link(name, title, class, ctx.qry.head, rev, ctx.qry.path); else if (!strcmp(ctx.qry.page, "patch")) - cgit_patch_link(name, title, class, ctx.qry.head, rev, ctx.qry.path); + cgit_patch_link(name, title, class, ctx.qry.head, rev, ctx.qry.oid2, ctx.qry.path); else if (!strcmp(ctx.qry.page, "refs")) cgit_refs_link(name, title, class, ctx.qry.head, rev, ctx.qry.path); else if (!strcmp(ctx.qry.page, "snapshot")) @@ -920,9 +920,17 @@ void cgit_diff_link(const char *name, const char *title, const char *class, } void cgit_patch_link(const char *name, const char *title, const char *class, - const char *head, const char *rev, const char *path) + const char *head, const char *new_rev, const char *old_rev, const char *path) { - reporevlink("patch", name, title, class, head, rev, path); + const char *delim; + + delim = repolink(title, class, "patch", head, path); + delim = emit_rev_arg(delim, new_rev); + if (old_rev) + url_arg(delim, "id2", old_rev); + html("'>"); + html_txt(name); + html(""); } void cgit_stats_link(const char *name, const char *title, const char *class, -- cgit 2.12.1