The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 03:15 UTC
test: use an empty config file instead of the null device for git fixtures on Windows (#30772)
Pyseph committed
Nov 5, 2026 at 21:22 UTC
95c0fbd4b5cb79639c1ea6fa001308323bdd329d
2 files changed
+17
-6
apps/server/src/vcs/GitVcsDriverCore.test.ts
+7
-3
@@ -1,6 +1,6 @@
1
// @effect-diagnostics nodeBuiltinImport:off - realpathSync.native resolves Windows 8.3 short names, which the Effect realPath does not.
2
import * as NodeFS from "node:fs";
3
-import * as NodeOS from "node:os";
3
+import * as NodePath from "node:path";
4
import * as NodeURL from "node:url";
5
import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
6
import * as NodeServices from "@effect/platform-node/NodeServices";
@@ -2172,7 +2172,11 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
2172
const upstream = yield* makeTmpDir();
2173
yield* initRepoWithCommit(upstream);
2174
const driver = yield* GitVcsDriver.GitVcsDriver;
2175
- const emptyTree = yield* git(upstream, ["hash-object", "-t", "tree", NodeOS.devNull]);
2175
+ // Git for Windows rejects the null device as a path, so use an empty file.
2176
+ const emptyDir = yield* makeTmpDir("git-vcs-driver-empty-");
2177
+ yield* writeTextFile(emptyDir, "empty", "");
2178
+ const emptyFile = NodePath.join(emptyDir, "empty");
2179
+ const emptyTree = yield* git(upstream, ["hash-object", "-t", "tree", emptyFile]);
2180
const root = yield* git(upstream, ["rev-parse", "HEAD"]);
2181
const rootSource = (yield* driver.getReviewDiffPreview({ cwd: upstream, commitSha: root }))
2182
.sources[0]!;
@@ -2192,7 +2196,7 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
2196
const sha = yield* git(upstream, ["rev-parse", "HEAD"]);
2197
const cwd = yield* makeTmpDir();
2198
yield* git(upstream, ["clone", "--depth=1", NodeURL.pathToFileURL(upstream).href, cwd], {
2195
- GIT_CONFIG_GLOBAL: NodeOS.devNull,
2199
+ GIT_CONFIG_GLOBAL: emptyFile,
2200
GIT_CONFIG_NOSYSTEM: "1",
2201
});
2202
assert.equal(yield* git(cwd, ["rev-parse", "--is-shallow-repository"]), "true");
scripts/check-changed.test.ts
+10
-3
@@ -6,7 +6,7 @@ import * as NodePath from "node:path";
6
import { expect } from "vite-plus/test";
7
import * as NodeServices from "@effect/platform-node/NodeServices";
8
import * as Option from "effect/Option";
9
-import { assert, describe, it } from "@effect/vitest";
9
+import { afterAll, assert, describe, it } from "@effect/vitest";
10
import * as Clock from "effect/Clock";
11
import * as Effect from "effect/Effect";
12
import * as Fiber from "effect/Fiber";
@@ -208,14 +208,21 @@ describe("check:changed", () => {
208
209
// Hooks export GIT_DIR and GIT_INDEX_FILE, and user config or the default
210
// ~/.config/git/ignore can ignore or sign fixture files.
211
+// Git for Windows rejects the null device as a config path, so use an empty file.
212
+const emptyConfigDir = NodeFS.mkdtempSync(
213
+ NodePath.join(NodeOS.tmpdir(), "t3-check-changed-config-"),
214
+);
215
+const emptyConfig = NodePath.join(emptyConfigDir, "empty.gitconfig");
216
+NodeFS.writeFileSync(emptyConfig, "");
217
+afterAll(() => NodeFS.rmSync(emptyConfigDir, { recursive: true, force: true }));
218
const fixtureConfig = {
212
- "core.excludesFile": NodeOS.devNull,
219
+ "core.excludesFile": emptyConfig,
220
"user.name": "Fixture",
221
"user.email": "fixture@example.invalid",
222
};
223
const env = {
224
...Object.fromEntries(Object.entries(process.env).filter(([name]) => !name.startsWith("GIT_"))),
218
- GIT_CONFIG_GLOBAL: NodeOS.devNull,
225
+ GIT_CONFIG_GLOBAL: emptyConfig,
226
GIT_CONFIG_NOSYSTEM: "1",
227
GIT_CONFIG_COUNT: String(Object.keys(fixtureConfig).length),
228
...Object.fromEntries(