Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,46 @@ it.effect("preserves destination probe failures instead of treating them as miss
);
});

it.effect("does not recreate an existing parent directory of the destination", () => {
const madeDirectories: Array<string> = [];
const cloneCalls: Array<string> = [];

return Effect.gen(function* () {
const service = yield* SourceControlRepositoryService.SourceControlRepositoryService;
yield* service.cloneRepository({
provider: SourceControlProviderKind.make("github"),
repository: "octocat/t3code",
destinationPath: "/drive-root/t3code",
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
protocol: "https",
});

assert.deepStrictEqual(
madeDirectories.filter((target) => target.startsWith("/drive-root")),
[],
);
assert.deepStrictEqual(cloneCalls, ["/drive-root"]);
}).pipe(
Effect.provide(
layer({
fileSystem: FileSystem.makeNoop({
exists: (target) => Effect.succeed(target === "/drive-root"),
makeDirectory: (target) =>
Effect.sync(() => {
madeDirectories.push(target);
}),
}),
git: {
execute: (input) =>
Effect.sync(() => {
cloneCalls.push(input.cwd);
return processOutput();
}),
},
}),
),
);
});

it.effect("publishes by creating the repository, adding a remote, and pushing upstream", () => {
const createCalls: Array<{ cwd: string; repository: string; visibility: string }> = [];
const remoteCalls: Array<{ cwd: string; preferredName: string; url: string }> = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,11 @@ export const make = Effect.gen(function* () {
});
}
} else {
yield* fileSystem.makeDirectory(path.dirname(normalizedDestination), { recursive: true });
// Skip existing parents: recursive mkdir on a Windows drive root fails with EPERM.
const parentPath = path.dirname(normalizedDestination);
if (!(yield* fileSystem.exists(parentPath))) {
yield* fileSystem.makeDirectory(parentPath, { recursive: true });
}
}

return {
Expand Down
Loading