Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): checkpoint restore reverts edits inside submodules #30829

Mergedmuhammad-auon-marham(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/30829/headmerged by juliusmarminge View on GitHub

Showing 4 changed files with 166 additions and 5 deletions (loading 1).

x
0 of 4 viewed, 4 left
69 additions and 0 deletionsapps/server/src/vcs/GitVcsDriver.test.tsModified
View file
@@ -1562,6 +1562,8 @@
"write-tree",
"commit-tree",
"update-ref",
+ // Without a parsed top level, capture cannot rule out submodules.
+ "submodule",
assert.strictEqual((yield* git(["show", `${checkpointRef}:file.txt`])).stdout, "unstaged\n");
assert.deepEqual(yield* fileSystem.readFile(path.join(cwd, ".git", "index")), originalIndex);
@@ -1800,6 +1802,73 @@
}).pipe(Effect.scoped, Effect.provide(layerGitContract)),
+it.effect("restores and deletes checkpoints inside populated submodules", () =>
+ Effect.gen(function* () {
+ const fileSystem = yield* FileSystem.FileSystem;
+ const path = yield* Path.Path;
+ const driver = yield* GitVcsDriver.makeVcsDriverShape();
+ const git = (cwd: string, args: ReadonlyArray<string>) =>
+ driver.execute({ operation: "test", cwd, args });
+ const makeRepository = Effect.fn("makeRepository")(function* (prefix: string) {
+ const cwd = yield* fileSystem.makeTempDirectoryScoped({ prefix });
+ yield* git(cwd, ["init"]);
+ yield* git(cwd, ["config", "user.email", "test@test.com"]);
+ yield* git(cwd, ["config", "user.name", "Test"]);
+ yield* fileSystem.writeFileString(path.join(cwd, "file.txt"), "original\n");
+ yield* git(cwd, ["add", "."]);
+ yield* git(cwd, ["commit", "-m", "initial"]);
+ return cwd;