codeant-cli 0.4.12 → 0.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/scm/index.js +7 -4
package/package.json
CHANGED
package/src/scm/index.js
CHANGED
|
@@ -65,10 +65,13 @@ export function detectRemote() {
|
|
|
65
65
|
export function detectRepoName() {
|
|
66
66
|
const origin = getOrigin();
|
|
67
67
|
if (!origin) return null;
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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;
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
// Auto-detect default branch
|