Function
getCodeHostCommitUrl
({
webUrl,
codeHostType,
commitHash,
}: {
webUrl?: string | null,
codeHostType: CodeHostType,
commitHash: string,
})
Source from the content-addressed store, hash-verified
| 344 | } |
| 345 | |
| 346 | export const getCodeHostCommitUrl = ({ |
| 347 | webUrl, |
| 348 | codeHostType, |
| 349 | commitHash, |
| 350 | }: { |
| 351 | webUrl?: string | null, |
| 352 | codeHostType: CodeHostType, |
| 353 | commitHash: string, |
| 354 | }) => { |
| 355 | if (!webUrl) { |
| 356 | return undefined; |
| 357 | } |
| 358 | |
| 359 | switch (codeHostType) { |
| 360 | case 'github': |
| 361 | return `${webUrl}/commit/${commitHash}`; |
| 362 | case 'gitlab': |
| 363 | return `${webUrl}/-/commit/${commitHash}`; |
| 364 | case 'gitea': |
| 365 | return `${webUrl}/commit/${commitHash}`; |
| 366 | case 'azuredevops': |
| 367 | return `${webUrl}/commit/${commitHash}`; |
| 368 | case 'bitbucketCloud': |
| 369 | return `${webUrl}/commits/${commitHash}`; |
| 370 | case 'bitbucketServer': |
| 371 | return `${webUrl}/commits/${commitHash}`; |
| 372 | case 'gerrit': |
| 373 | return `${webUrl}/+/${commitHash}`; |
| 374 | case 'genericGitHost': |
| 375 | return undefined; |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | export const getCodeHostBrowseAtBranchUrl = ({ |
| 380 | webUrl, |
Tested by
no test coverage detected