Skip to content

Commit 5e2e967

Browse files
authored
Merge pull request #1549 from NixOS/feat/github-diffs
feat: Offload git diffs to GitHub
2 parents 650871b + f1b2613 commit 5e2e967

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/root/common.tt

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -347,13 +347,23 @@ BLOCK renderDiffUri;
347347
url = res.0;
348348
branch = res.1;
349349
IF bi1.type == "hg" || bi1.type == "git" %]
350-
<a target="_blank" [% HTML.attributes(href => c.uri_for('/api/scmdiff', {
351-
uri = url,
352-
rev1 = bi1.revision,
353-
rev2 = bi2.revision,
354-
type = bi1.type,
355-
branch = branch
356-
})) %]>[% HTML.escape(contents) %]</a>
350+
[% IF url.substr(0, 19) == "https://github.com/" %]
351+
<a target="_blank" [% HTML.attributes(href =>
352+
url
353+
_ "/compare/"
354+
_ bi1.revision
355+
_ "..."
356+
_ bi2.revision,
357+
) %]>[% HTML.escape(contents) %]</a>
358+
[% ELSE %]
359+
<a target="_blank" [% HTML.attributes(href => c.uri_for('/api/scmdiff', {
360+
uri = url,
361+
rev1 = bi1.revision,
362+
rev2 = bi2.revision,
363+
type = bi1.type,
364+
branch = branch
365+
})) %]>[% HTML.escape(contents) %]</a>
366+
[% END %]
357367
[% ELSE;
358368
contents;
359369
END;

0 commit comments

Comments
 (0)