Skip to content

Commit 43b7b3f

Browse files
committed
nested gitlab fix
1 parent 040d564 commit 43b7b3f

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/scm/index.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,13 @@ export function detectRemote() {
6565
export function detectRepoName() {
6666
const origin = getOrigin();
6767
if (!origin) return null;
68-
// Handle SSH: git@github.com:owner/repo.git
69-
// Handle HTTPS: https://github.com/owner/repo.git
70-
const match = origin.match(/[/:]([\w.-]+(?:\/[\w.-]+)+?)(?:\.git)?$/);
71-
return match ? match[1] : null;
68+
// SSH: git@host:path/to/repo[.git]
69+
const sshMatch = origin.match(/^[^@]+@[^:]+:(.+?)(?:\.git)?$/);
70+
if (sshMatch) return sshMatch[1];
71+
// HTTPS: https://[user:pass@]host/path/to/repo[.git]
72+
const httpsMatch = origin.match(/^https?:\/\/[^/]+\/(.+?)(?:\.git)?$/);
73+
if (httpsMatch) return httpsMatch[1];
74+
return null;
7275
}
7376

7477
// Auto-detect default branch

0 commit comments

Comments
 (0)