Skip to content

Commit 947c24a

Browse files
Merge pull request #22 from CodeAnt-AI/nested-gitlb
Nested gitlb
2 parents 040d564 + 180c663 commit 947c24a

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codeant-cli",
3-
"version": "0.4.12",
3+
"version": "0.4.13",
44
"description": "Code review CLI tool",
55
"type": "module",
66
"bin": {

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):\/\/[^/]+\/(.+?)(?:\.git)?$/);
73+
if (httpsMatch) return httpsMatch[1];
74+
return null;
7275
}
7376

7477
// Auto-detect default branch

0 commit comments

Comments
 (0)