Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(source-control): SCP-style remotes with a leading slash keep their repository path #44007

Mergedonly21mil(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/44007/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 5 additions and 1 deletion.

x
0 of 2 viewed, 2 left
4 additions and 0 deletionspackages/source-control-core/src/server/SourceControlProvider.test.tsModified
View file
@@ -16,12 +16,16 @@
​
it.each([
["git@github.com:T3Tools/t3code.git", "T3Tools/t3code"],
+ ["git@github.com:/T3Tools/t3code.git", "T3Tools/t3code"],
["github.com:T3Tools/t3code.git", "T3Tools/t3code"],
+ ["github.com:/T3Tools/t3code.git", "T3Tools/t3code"],
["gitlab.com:T3Tools/platform/t3code", "T3Tools/platform/t3code"],
+ ["hg::user@host:Owner/Repo.git", null],
["https://github.com/T3Tools/t3code.git", "T3Tools/t3code"],
["https://github.com/T3Tools/t3code.git?view=compact", "T3Tools/t3code"],
["https://github.com/T3Tools/t3code.git#section", "T3Tools/t3code"],
["C:/repos/t3code", null],
+ ["file:///tmp/T3Tools/t3code.git", null],
])("reads the repository path of %s", (remoteUrl, expected) => {
assert.strictEqual(repositoryPathFromRemoteUrl(remoteUrl), expected);
});
1 addition and 1 deletionpackages/source-control-core/src/server/SourceControlProvider.tsModified
View file
@@ -111,7 +111,7 @@
​
const match =
- /^(?:[^@/\s]+@[^:/\s]+:|[^@:/\\\s]{2,}:(?!:)|(?:ssh|https?|git):\/\/[^/]+\/)((?:[^/\s]+\/)+[^/\s]+?)(?:\.git)?\/?$/iu.exec(
+ /^(?:[^@/:\s]+@[^:/\s]+:\/?|[^@:/\\\s]{2,}:(?!:)\/?|(?:ssh|https?|git):\/\/[^/]+\/)((?:[^/\s]+\/)+[^/\s]+?)(?:\.git)?\/?$/iu.exec(
trimmed,
const path = match?.[1]?.trim() ?? "";