diff --git a/include/freshports.php b/include/freshports.php index 7eb63ba0..0dc2c87f 100644 --- a/include/freshports.php +++ b/include/freshports.php @@ -114,11 +114,53 @@ function freshports_git_commit_Link_freebsd($revision, $hostname, $path) { } function freshports_git_commit_Link_github($revision, $hostname, $path) { - return '' . freshports_GitHub_Icon('commit hash:' . $revision) . ''; + $url = 'https://github.com/FreeBSD/'; + + switch ($path) { + case '/ports': + $url .= 'freebsd-ports'; + break; + + case '/doc': + $url .= 'freebsd-doc'; + break; + + case '/src': + $url .= 'freebsd-src'; + break; + + default: + $url .= 'UNKOWN_PATH'; + break; + } + + $url .= '/commit/' . htmlentities($revision); + return '' . freshports_GitHub_Icon('commit hash:' . $revision) . ''; } function freshports_git_commit_Link_gitlab($revision, $hostname, $path) { - return '' . freshports_GitLab_Icon('commit hash:' . $revision) . ''; + $url = 'https://gitlab.com/FreeBSD/'; + + switch ($path) { + case '/ports': + $url .= 'freebsd-ports'; + break; + + case '/doc': + $url .= 'freebsd-doc'; + break; + + case '/src': + $url .= 'freebsd-src'; + break; + + default: + $url .= 'UNKOWN_PATH'; + break; + } + + $url .= '/commit/' . htmlentities($revision); + return '' . freshports_GitLab_Icon('commit hash:' . $revision) . ''; } function freshports_git_commit_Link_codeberg($revision, $hostname, $path) {