Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -179,7 +179,7 @@ it.effect("clones a looked-up repository into the requested destination", () =>
assert.deepStrictEqual(cloneCalls, [
{
cwd: parent,
args: ["clone", "--progress", CLONE_URLS.url, "t3code"],
args: ["clone", "--progress", "--", CLONE_URLS.url, "t3code"],
},
]);
}).pipe(
Expand All @@ -198,6 +198,43 @@ it.effect("clones a looked-up repository into the requested destination", () =>
}).pipe(Effect.provide(NodeServices.layer)),
);

it.effect.each(["--bare", "source.git"])(
"clones a local repository named %s as a working tree",
(repositoryName) =>
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const git = yield* GitVcsDriver.GitVcsDriver;
const parent = yield* fs.makeTempDirectoryScoped({ prefix: "t3-clone-options-" });
yield* git.execute({
operation: "test.init",
cwd: parent,
args: ["init", "--bare", path.join(parent, repositoryName)],
});
const destinationPath = path.join(parent, "checkout");
yield* Effect.gen(function* () {
const service = yield* SourceControlRepositoryService.SourceControlRepositoryService;
const result = yield* service.cloneRepository({
remoteUrl: repositoryName,
destinationPath,
});
assert.strictEqual(result.cwd, destinationPath);
assert.isTrue(yield* fs.exists(path.join(destinationPath, ".git")));
}).pipe(Effect.provide(makeLayer({ git: { execute: git.execute } })));
}).pipe(
Effect.provide(
GitVcsDriver.layer.pipe(
Layer.provide(
ServerConfig.layerTest(process.cwd(), {
prefix: "t3-clone-options-config-",
}),
),
Layer.provideMerge(NodeServices.layer),
),
),
),
);

it.effect("reports clone progress from git's stderr and keeps its error text on failure", () =>
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,13 @@ export const make = Effect.gen(function* () {
.execute({
operation: "SourceControlRepositoryService.cloneRepository",
cwd: path.dirname(prepared.destinationPath),
args: ["clone", "--progress", prepared.cloneUrl, path.basename(prepared.destinationPath)],
args: [
"clone",
"--progress",
"--",
prepared.cloneUrl,
path.basename(prepared.destinationPath),
],
timeoutMs: options?.timeoutMs === undefined ? CLONE_TIMEOUT_MS : options.timeoutMs,
// Progress redraws add up on a slow multi-GB clone. The buffered copy
// is never read (the tail is kept by hand above), so keep it small
Expand Down
Loading