Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions runtime/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36984,9 +36984,11 @@ async function git(cwd, args, indexFileOrOptions) {
const maxOutputBytes = options.maxOutputBytes ?? (gitSubcommand(args) === "ls-files" ? INDEX_LISTING_MAX_BYTES : DEFAULT_MAX_OUTPUT_BYTES);
const env = {
PATH: process.env.PATH ?? "",
// Git for Windows special-cases "/dev/null" for config paths; "NUL" is
// an unreadable file to some builds (Windows ARM64 Git fails on it).
...options.userIdentity === true ? userConfigEnvironment() : {
GIT_CONFIG_GLOBAL: nullDevice,
GIT_CONFIG_SYSTEM: nullDevice,
GIT_CONFIG_GLOBAL: "/dev/null",
GIT_CONFIG_SYSTEM: "/dev/null",
GIT_CONFIG_NOSYSTEM: "1"
},
GIT_ATTR_NOSYSTEM: "1",
Expand Down Expand Up @@ -38740,7 +38742,7 @@ function isDeclaredStateRoot(normalized, invocation, policy) {
if (!rel.startsWith("..") && !isAbsolute(rel)) return true;
}
const userHomePattern = /^(\/Users\/[^/]+|\/home\/[^/]+|\/root)(?:\/.*)?$/u;
const winUserHomePattern = /^[a-zA-Z]:\\Users\\[^\\]+(?:\\.*)?$/u;
const winUserHomePattern = /^(?:[a-zA-Z]:)?\\Users\\[^\\]+(?:\\.*)?$/u;
return userHomePattern.test(normalized) || winUserHomePattern.test(normalized);
}
function isValidInheritedStatePath(path43, invocation, policy) {
Expand Down
6 changes: 4 additions & 2 deletions src/git/git-exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,11 @@ export async function git(
?? (gitSubcommand(args) === "ls-files" ? INDEX_LISTING_MAX_BYTES : DEFAULT_MAX_OUTPUT_BYTES);
const env: Record<string, string> = {
PATH: process.env.PATH ?? "",
// Git for Windows special-cases "/dev/null" for config paths; "NUL" is
// an unreadable file to some builds (Windows ARM64 Git fails on it).
...(options.userIdentity === true ? userConfigEnvironment() : {
GIT_CONFIG_GLOBAL: nullDevice,
GIT_CONFIG_SYSTEM: nullDevice,
GIT_CONFIG_GLOBAL: "/dev/null",
GIT_CONFIG_SYSTEM: "/dev/null",
GIT_CONFIG_NOSYSTEM: "1",
}),
GIT_ATTR_NOSYSTEM: "1",
Expand Down
2 changes: 1 addition & 1 deletion src/platform/sandbox/seatbelt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function isDeclaredStateRoot(
}

const userHomePattern = /^(\/Users\/[^/]+|\/home\/[^/]+|\/root)(?:\/.*)?$/u;
const winUserHomePattern = /^[a-zA-Z]:\\Users\\[^\\]+(?:\\.*)?$/u;
const winUserHomePattern = /^(?:[a-zA-Z]:)?\\Users\\[^\\]+(?:\\.*)?$/u;
return userHomePattern.test(normalized) || winUserHomePattern.test(normalized);
}

Expand Down
4 changes: 3 additions & 1 deletion tests/runtime/dependency-link.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ describe("probeCowSupport", () => {
},
);

it("reports a forced clone failure and removes the probe directory", async () => {
// The probe resolves the host's system `cp` by absolute path before cloning.
it.skipIf(process.platform !== "darwin" && process.platform !== "linux")(
"reports a forced clone failure and removes the probe directory", async () => {
let probeRoot: string | undefined;

await expect(probeCowSupport({
Expand Down
11 changes: 5 additions & 6 deletions tests/runtime/git-exec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,12 @@ describe("index listing bound", () => {
// Index-only entries with long names: ~9 MB of listing, no files on disk.
const directory = "d".repeat(200);
const total = 11_000;
for (let start = 0; start < total; start += 500) {
const args = ["update-index", "--add"];
for (let index = start; index < start + 500; index += 1) {
args.push("--cacheinfo", `100644,${blob},${directory}/${directory}/${directory}/${directory}/f${index}`);
}
expect((await git(repo, args)).exitCode).toBe(0);
// Through stdin: Windows caps a command line at 32K characters.
let entries = "";
for (let index = 0; index < total; index += 1) {
entries += `100644 ${blob}\t${directory}/${directory}/${directory}/${directory}/f${index}\n`;
}
expect((await git(repo, ["update-index", "--index-info"], { stdin: entries })).exitCode).toBe(0);

const listed = await git(repo, ["ls-files", "-v", "-z"]);

Expand Down
2 changes: 1 addition & 1 deletion tests/runtime/pipeline-runtime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2885,7 +2885,7 @@ describe("runPipeline", () => {
"pipeline-fresh-fixers-round-2-fix",
]);
expect(worktrees.every(entry => !entry.residue)).toBe(true);
});
}, 120_000);

it("fixes a blocker and returns decision-ready after a clean re-review", async () => {
const repo = await initRepo();
Expand Down
5 changes: 4 additions & 1 deletion tests/runtime/worktree-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ async function canonicalPathsEqual(left: string, right: string): Promise<boolean
}

function managedRootOf(repo: string): string {
return join(realpathSync(repo), ".worktrees", "claude-architect");
// native: expands Windows 8.3 short names (RUNNER~1) the way Git reports paths.
return join(realpathSync.native(repo), ".worktrees", "claude-architect");
}

async function runGit(cwd: string, args: string[]): Promise<string> {
Expand Down Expand Up @@ -206,6 +207,8 @@ describe("WorktreeManager", () => {
`[diff "x"]\n\ttextconv = "${process.execPath}" -e "require('fs').writeFileSync('${marker.replaceAll("\\", "/")}','')"\n`,
{ flag: "a" },
);
// Git for Windows marks .git hidden, which a plain overwrite cannot open.
await rm(join(attempt.path, ".git"));
await writeFile(join(attempt.path, ".git"), `gitdir: ${join(hostile, ".git")}\n`);
await writeFile(join(attempt.path, ".gitattributes"), "a.txt diff=x\n");
await writeFile(join(attempt.path, "a.txt"), "changed\n");
Expand Down
9 changes: 7 additions & 2 deletions tests/runtime/worktree-sweep.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
writeFile,
} from "node:fs/promises";
import { tmpdir } from "node:os";
import { realpathSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
Expand Down Expand Up @@ -903,8 +904,12 @@ describe("startup worktree sweep", () => {

await expectMissing(orphan.path);
const listed = await git(repo.directory, ["worktree", "list", "--porcelain", "-z"]);
expect(listed.stdout).not.toContain(orphan.path);
expect(listed.stdout).toContain(await realpath(userWorktree));
// Git reports forward slashes on Windows; compare resolved paths.
const registered = listed.stdout.split("\0")
.filter(field => field.startsWith("worktree "))
.map(field => path.resolve(field.slice("worktree ".length)));
expect(registered).not.toContain(path.resolve(orphan.path));
expect(registered).toContain(path.resolve(realpathSync.native(userWorktree)));
await expect(readFile(
path.join(repo.directory, ".worktrees", "claude-architect", ".gitignore"),
"utf8",
Expand Down
Loading