fix(server): end clone options before the repository URL (#14781)
This commit is contained in:
1 parent
411cef0008
commit
e65063ccf6
2 files changed
+45
-2
No files matched your search
@@ -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(
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user