Skip to content

Commit de5b774

Browse files
PR Batch Testerclaude
andcommitted
fix(client): ghq clone paths on Windows use backslashes throughout
A Windows base folder showed C:\base\github.com/owner/repo in the clone destination field. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 8cde398 commit de5b774

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

‎packages/client-runtime/src/operations/projects.test.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { EnvironmentId, ProjectId } from "@t3tools/contracts";
44

55
import {
66
findExistingAddProject,
7+
getCloneDestinationPath,
78
getCloneDirectoryName,
89
getCloneDirectoryPath,
910
getDefaultCloneUrl,
@@ -74,6 +75,12 @@ describe("add project shared logic", () => {
7475
);
7576
expect(getCloneDirectoryPath("https://github.com/owner/../../repo", true)).toBe("repo");
7677
expect(getCloneDirectoryPath("/srv/git/repo.git", true)).toBe("repo");
78+
expect(
79+
getCloneDestinationPath(
80+
"C:\\Users\\me\\ghq",
81+
getCloneDirectoryPath("[email protected]:owner/repo.git", true),
82+
),
83+
).toBe("C:\\Users\\me\\ghq\\github.com\\owner\\repo");
7784
});
7885

7986
it("keeps a numeric repository name that sits on a path", () => {

‎packages/client-runtime/src/operations/projects.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ export function getCloneDestinationPath(
204204
if (name.length === 0) {
205205
return directoryPath;
206206
}
207-
return `${ensureBrowseDirectoryPath(directoryPath)}${name}`;
207+
const base = ensureBrowseDirectoryPath(directoryPath);
208+
return `${base}${base.endsWith("\\") ? name.replaceAll("/", "\\") : name}`;
208209
}
209210

210211
export function getNewProjectPathPreview(newProjectsRoot: string, name: string): string {

0 commit comments

Comments
 (0)