fix: Github diffs URL

In https://github.com/NixOS/hydra/pull/1549 diffs were
offloaded to github for performance reasons.

While in some endpoints github accepts `.git` suffixed in the
repository name, in the comparison endpoint this does not seem
to be the case.

Specifically, on the main nixos org hydra this isn't working:

Example job: https://hydra.nixos.org/build/320178054

Generates a comparison link like so:
078d69f039...1cd347bf33

This just stips away the suffix and seems to work fine in local
testing.
This commit is contained in:
Dima
2026-01-27 01:45:51 +01:00
parent 8bc95a96f7
commit 26e4d5eb54

View File

@@ -347,9 +347,10 @@ BLOCK renderDiffUri;
url = res.0;
branch = res.1;
IF bi1.type == "hg" || bi1.type == "git" %]
[% IF url.substr(0, 19) == "https://github.com/" %]
[% IF url.substr(0, 19) == "https://github.com/";
github_url = url.replace('\.git$', '') %]
<a target="_blank" [% HTML.attributes(href =>
url
github_url
_ "/compare/"
_ bi1.revision
_ "..."