Skip to content
Source
Sign inSign up
pingdotgg/t3code

Clean up leaked tmp_pack files after failed status refresh #2026

ClosedSAKETH11111(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/2026/headopened View on GitHub

Showing 2 changed files with 239 additions and 1 deletion (loading 1).

x
0 of 2 viewed, 2 left
239 additions and 1 deletionapps/server/src/git/Layers/GitCore.test.tsModified
View file
@@ -1,4 +1,4 @@
-import { existsSync } from "node:fs";
+import { existsSync, writeFileSync } from "node:fs";
import path from "node:path";
​
import * as NodeServices from "@effect/platform-node/NodeServices";
@@ -976,6 +976,244 @@
}),
​
+ it.effect("removes newly leaked tmp_pack files after a failed upstream refresh", () =>
+ Effect.gen(function* () {
+ const tmp = yield* makeTmpDir();
+ const gitCommonDir = path.join(tmp, ".git");
+ const packDir = path.join(gitCommonDir, "objects", "pack");
+ yield* makeDirectory(packDir);
+​
+ const existingTmpPack = path.join(packDir, "tmp_pack_existing");
+ const leakedTmpPack = path.join(packDir, "tmp_pack_new");
+ const preservedPack = path.join(packDir, "pack-keep.pack");
+ yield* writeTextFile(existingTmpPack, "existing temporary pack\n");
+ yield* writeTextFile(preservedPack, "keep this pack file\n");
+​
+ const ok = (stdout = "") =>
+ Effect.succeed({
+ code: 0,
+ stdout,
+ stderr: "",
+ stdoutTruncated: false,
+ stderrTruncated: false,