@devries-cameron20 / t3code Mirror · read-only / commits / d5e6f69810
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 01:45 UTC

fix(server): cloning into a new folder directly under a drive root no longer fails (#18265)

Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com> Co-authored-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Pujitha Paladugu committed Oct 19, 2026 at 13:25 UTC d5e6f69810c08dd2e741a0fc7d8e33e535b73c57
2 files changed +49 -4
apps/server/src/sourceControl/SourceControlRepositoryService.test.ts
+44 -3
@@ -270,13 +270,14 @@ it.effect("keeps arbitrary Bitbucket request failures out of the repository mess
270 }),
271 );
272
273 -it.effect("clones a looked-up repository into the requested destination", () =>
273 +it.effect("clones a looked-up repository after creating missing parent directories", () =>
274 Effect.gen(function* () {
275 const fs = yield* FileSystem.FileSystem;
276 const path = yield* Path.Path;
277 - const parent = yield* fs.makeTempDirectoryScoped({
277 + const temporaryDirectory = yield* fs.makeTempDirectoryScoped({
278 prefix: "t3-source-control-clone-parent-",
279 });
280 + const parent = path.join(temporaryDirectory, "missing", "nested");
281 const destinationPath = path.join(parent, "t3code");
282 const cloneCalls: Array<{ cwd: string; args: ReadonlyArray<string> }> = [];
283
@@ -305,7 +306,8 @@ it.effect("clones a looked-up repository into the requested destination", () =>
306 layer({
307 git: {
308 execute: (input) =>
308 - Effect.sync(() => {
309 + Effect.gen(function* () {
310 + assert.isTrue(yield* fs.exists(parent).pipe(Effect.orDie));
311 cloneCalls.push({ cwd: input.cwd, args: input.args });
312 return processOutput();
313 }),
@@ -528,6 +530,45 @@ it.effect("preserves destination probe failures instead of treating them as miss
530 );
531 });
532
533 +it.effect("clones directly under an existing filesystem root without recreating it", () =>
534 + Effect.gen(function* () {
535 + const path = yield* Path.Path;
536 + const root = path.parse(path.resolve(".")).root;
537 + const cloneCalls: Array<string> = [];
538 +
539 + yield* Effect.gen(function* () {
540 + const service = yield* SourceControlRepositoryService.SourceControlRepositoryService;
541 + yield* service.cloneRepository({
542 + provider: SourceControlProviderKind.make("github"),
543 + repository: "octocat/t3code",
544 + destinationPath: path.join(root, "t3code"),
545 + protocol: "https",
546 + });
547 +
548 + assert.deepStrictEqual(cloneCalls, [root]);
549 + }).pipe(
550 + Effect.provide(
551 + layer({
552 + fileSystem: FileSystem.makeNoop({
553 + exists: (target) => Effect.succeed(target === root),
554 + makeDirectory: (target) =>
555 + Effect.sync(() => {
556 + assert.notStrictEqual(target, root, "must not try to create the existing root");
557 + }),
558 + }),
559 + git: {
560 + execute: (input) =>
561 + Effect.sync(() => {
562 + cloneCalls.push(input.cwd);
563 + return processOutput();
564 + }),
565 + },
566 + }),
567 + ),
568 + );
569 + }).pipe(Effect.provide(NodePath.layer)),
570 +);
571 +
572 it.effect("publishes by creating the repository, adding a remote, and pushing upstream", () => {
573 const createCalls: Array<{ cwd: string; repository: string; visibility: string }> = [];
574 const remoteCalls: Array<{ cwd: string; preferredName: string; url: string }> = [];
apps/server/src/sourceControl/SourceControlRepositoryService.ts
+5 -1
@@ -262,7 +262,11 @@ export const make = Effect.gen(function* () {
262 });
263 }
264 } else {
265 - yield* fileSystem.makeDirectory(path.dirname(normalizedDestination), { recursive: true });
265 + // Skip existing parents: recursive mkdir on a Windows drive root fails with EPERM.
266 + const parentPath = path.dirname(normalizedDestination);
267 + if (!(yield* fileSystem.exists(parentPath))) {
268 + yield* fileSystem.makeDirectory(parentPath, { recursive: true });
269 + }
270 }
271
272 return {