Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(shared): keep Windows clone paths out of SSH conversion #24886

ClosedQuarks07(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/24886/headopened View on GitHub

Showing 2 changed files with 20 additions and 0 deletions.

x
0 of 2 viewed, 2 left
17 additions and 0 deletionspackages/shared/src/cloneUrl.test.tsModified
View file
@@ -3,6 +3,23 @@
import { cloneUrlForProtocol, cloneUrlProtocol } from "./cloneUrl.ts";
​
describe("cloneUrlForProtocol", () => {
+ it.each(["C:\\repos\\project.git", "c:\\repos\\project.git", "C:/repos/project.git"])(
+ "does not offer network protocols for a Windows local path: %s",
+ (path) => {
+ expect(cloneUrlProtocol(path)).toBeNull();
+ expect(cloneUrlForProtocol(path, "ssh")).toBeNull();
+ expect(cloneUrlForProtocol(path, "https")).toBeNull();
+ },
+ );
+​
+ it.each(["c:repo.git", "git@c:repo.git", "ssh://git@c/repo.git"])(
+ "keeps SSH URLs with a single-letter host: %s",
+ (url) => {
+ expect(cloneUrlProtocol(url)).toBe("ssh");
+ expect(cloneUrlForProtocol(url, "https")).toBe("https://c/repo.git");
+ },
+ );
+​
it.each([
["ordinary", "user:password"],
["an embedded at sign", "user:pa@rt"],
3 additions and 0 deletionspackages/shared/src/cloneUrl.tsModified
View file
@@ -1,3 +1,5 @@
+import { isWindowsDrivePath } from "./path.ts";
+​