MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / getCodeHostCommitUrl

Function getCodeHostCommitUrl

packages/web/src/lib/utils.ts:346–377  ·  view source on GitHub ↗
({
    webUrl,
    codeHostType,
    commitHash,
}: {
    webUrl?: string | null,
    codeHostType: CodeHostType,
    commitHash: string,
})

Source from the content-addressed store, hash-verified

344}
345
346export 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
379export const getCodeHostBrowseAtBranchUrl = ({
380 webUrl,

Callers 1

getColumnsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected