You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* This program and the accompanying materials are made
5
5
* available under the terms of the Eclipse Public License 2.0
@@ -14,27 +14,40 @@ import { injectable } from 'inversify';
14
14
@injectable()
15
15
exportclassStringUtil{
16
16
/**
17
-
* method extracts a test repo name from git clone https url;
18
-
* it splits the url into string[] by "/" or ".", deletes empty elements and elements that contains just "git", "main" or "tree" word, than returns the last one;
19
-
* please, avoid to call the test repo as just "git" or to use dots in the name, like: github.com/user/git.git, github.com/user/name.with.dots.
20
-
* @param url git https url (which using for "git clone")
21
-
* @return project name
17
+
* extracts the project (repository) name from a Git HTTPS URL.
18
+
*
19
+
* Handles URLs from GitLab, GitHub, and Bitbucket by:
20
+
* - Removing query parameters and hash fragments;
21
+
* - Trimming branch or tree paths (e.g. `/tree/<branch>`, `/-/tree/<branch>`, `/src/<branch>`);
22
+
* - Stripping the `.git` suffix.
23
+
*
24
+
* ⚠️ Avoid naming repositories as `"git"` or using dots in names (`name.with.dots`),
25
+
* as they may be treated as separators.
26
+
*
27
+
* @param url Git HTTPS URL (as used for `git clone`)
28
+
* @returns Extracted project name, or an empty string if parsing fails
0 commit comments