MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / extractRepoNameFromUrl

Function extractRepoNameFromUrl

evals/buffbench/setup-test-repo.ts:19–36  ·  view source on GitHub ↗
(repoUrl: string)

Source from the content-addressed store, hash-verified

17 * - https://github.com/user/repo -> repo
18 */
19export function extractRepoNameFromUrl(repoUrl: string): string {
20 // Remove .git suffix if present
21 let cleanUrl = repoUrl.endsWith('.git') ? repoUrl.slice(0, -4) : repoUrl
22
23 // Handle SSH format: git@github.com:user/repo
24 if (cleanUrl.includes('@') && cleanUrl.includes(':')) {
25 cleanUrl = cleanUrl.split(':')[1]
26 }
27
28 // Handle HTTPS format: https://github.com/user/repo
29 if (cleanUrl.includes('://')) {
30 cleanUrl = cleanUrl.split('://')[1]
31 }
32
33 // Remove domain and get the last part (repo name)
34 const parts = cleanUrl.split('/')
35 return parts[parts.length - 1]
36}
37
38/**
39 * Executes a git command with retry logic and exponential backoff

Callers 3

generateEvalFileV2Function · 0.90
pickCommitsFunction · 0.90
setupTestRepoFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected