Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): resolve a branch's base once while its refs and config are unchanged #40125

Mergedjuliusmarmingemerged 6 commits intomain fromrefs/pull/40125/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 83 additions and 0 deletions (loading 1).

x
0 of 2 viewed, 2 left
83 additions and 0 deletionsapps/server/src/vcs/GitVcsDriverCore.test.tsModified
View file
@@ -876,6 +876,89 @@
).pipe(Effect.provide(layerTest)),
​
+it.effect("resolves a branch's base once while its refs and branch config are unchanged", () =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const delegate = yield* ChildProcessSpawner.ChildProcessSpawner;
+ const spawnedArgs: Array<ReadonlyArray<string>> = [];
+ let failRemoteLookup = false;
+ const spawner = ChildProcessSpawner.make((command) => {
+ if (!ChildProcess.isStandardCommand(command)) return delegate.spawn(command);
+ spawnedArgs.push(command.args.map(String));
+ return failRemoteLookup && command.args[0] === "remote"
+ ? Effect.fail(
+ PlatformError.systemError({
+ _tag: "Unknown",
+ module: "ChildProcess",
+ method: "spawn",
+ }),
+ )
+ : delegate.spawn(command);
+ });
+ const driver = yield* makeGitVcsDriverCore().pipe(
+ Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),
+ );
+ const cwd = yield* makeTmpDir();
+ yield* initRepoWithCommit(cwd);
+ yield* git(cwd, ["checkout", "-b", "feature/x"]);
+ yield* writeTextFile(cwd, "feature.txt", "feature\n");