From f1b26134d7c1c91bb01f3f2d0b2715e275e709fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20He=C3=9F?= Date: Sun, 4 Jan 2026 15:49:25 +0100 Subject: [PATCH] feat: Offload git diffs to GitHub If we are on GitHub, use their scm diff by default which is more feature-rich and offloads the diff work to stronger infrastructure --- src/root/common.tt | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/root/common.tt b/src/root/common.tt index b18d33f7..37c90846 100644 --- a/src/root/common.tt +++ b/src/root/common.tt @@ -347,13 +347,23 @@ BLOCK renderDiffUri; url = res.0; branch = res.1; IF bi1.type == "hg" || bi1.type == "git" %] - c.uri_for('/api/scmdiff', { - uri = url, - rev1 = bi1.revision, - rev2 = bi2.revision, - type = bi1.type, - branch = branch - })) %]>[% HTML.escape(contents) %] + [% IF url.substr(0, 19) == "https://github.com/" %] + + url + _ "/compare/" + _ bi1.revision + _ "..." + _ bi2.revision, + ) %]>[% HTML.escape(contents) %] + [% ELSE %] + c.uri_for('/api/scmdiff', { + uri = url, + rev1 = bi1.revision, + rev2 = bi2.revision, + type = bi1.type, + branch = branch + })) %]>[% HTML.escape(contents) %] + [% END %] [% ELSE; contents; END;