MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / truncateSha

Function truncateSha

packages/web/src/lib/utils.ts:29–35  ·  view source on GitHub ↗
(ref: string)

Source from the content-addressed store, hash-verified

27 * Returns the input unchanged for symbolic refs (branches, tags, etc.).
28 */
29export function truncateSha(ref: string): string {
30 const match = ref.match(/^([0-9a-f]{40})(.*)$/i);
31 if (match) {
32 return match[1].slice(0, 7) + match[2];
33 }
34 return ref;
35}
36
37/**
38 * Creates an invite link URL from the base URL and invite ID

Callers 3

PathHeaderFunction · 0.90
CodePreviewPanelFunction · 0.90
GetDiffToolComponentFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected