MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / normalizeAzureDevOpsPath

Function normalizeAzureDevOpsPath

src/utils/parse-git-remote-url.ts:77–92  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

75}
76
77function 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
94function buildParsedGitRemoteUrl(
95 url: string,

Callers 1

buildParsedGitRemoteUrlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected