(path: string)
| 75 | } |
| 76 | |
| 77 | function normalizeAzureDevOpsPath(path: string): string { |
| 78 | // Azure paths look like `org/project/_git/repo` or `org/_git/repo` over |
| 79 | // HTTPS, and `v3/org/project/repo` over SSH. Normalize to `org/project/repo` |
| 80 | // (or `org/repo`) so it lines up with constructBranchUrl's expectations. |
| 81 | const segments = path.split("/").filter(Boolean); |
| 82 | const gitIndex = segments.indexOf("_git"); |
| 83 | if (gitIndex === -1) { |
| 84 | // Only the SSH form carries the `v3` prefix, and it never carries `_git`. |
| 85 | // Checking that first leaves an organization actually named `v3` alone. |
| 86 | if (segments[0] === "v3") segments.shift(); |
| 87 | return segments.join("/"); |
| 88 | } |
| 89 | return [...segments.slice(0, gitIndex), ...segments.slice(gitIndex + 1)].join( |
| 90 | "/", |
| 91 | ); |
| 92 | } |
| 93 | |
| 94 | function buildParsedGitRemoteUrl( |
| 95 | url: string, |
no outgoing calls
no test coverage detected