Skip to content

Commit 180c663

Browse files
pranavcodeantclaude
andcommitted
Fix detectRepoName regex to handle userless SCP and git:// remotes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ea9a962 commit 180c663

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/scm/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ export function detectRepoName() {
6666
const origin = getOrigin();
6767
if (!origin) return null;
6868
// SSH: git@host:path/to/repo[.git]
69-
const sshMatch = origin.match(/^[^@]+@[^:]+:(.+?)(?:\.git)?$/);
69+
const sshMatch = origin.match(/^(?:[^@]+@)?[^:]+:(.+?)(?:\.git)?$/);
7070
if (sshMatch) return sshMatch[1];
7171
// HTTPS: https://[user:pass@]host/path/to/repo[.git]
72-
const httpsMatch = origin.match(/^https?:\/\/[^/]+\/(.+?)(?:\.git)?$/);
72+
const httpsMatch = origin.match(/^(?:https?|git):\/\/[^/]+\/(.+?)(?:\.git)?$/);
7373
if (httpsMatch) return httpsMatch[1];
7474
return null;
7575
}

0 commit comments

Comments
 (0)