Skip to content

Commit bf36ad6

Browse files
That1Drifterclaude
andcommitted
fix(server): accept a negative zero GIT_CONFIG_COUNT
Git parses GIT_CONFIG_COUNT with strtoul, so -0 is a valid zero count. The helper treated it as malformed and skipped the long-path injection. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent bc64467 commit bf36ad6

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎apps/server/src/vcs/GitVcsDriverCore.test.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3425,6 +3425,16 @@ describe("windowsLongPathConfigEnv", () => {
34253425
}
34263426
});
34273427

3428+
it("accepts a negative zero count, which Git parses as zero", () => {
3429+
for (const count of ["-0", "-00", " -0"]) {
3430+
assert.deepStrictEqual(windowsLongPathConfigEnv("win32", { GIT_CONFIG_COUNT: count }), {
3431+
GIT_CONFIG_COUNT: "1",
3432+
GIT_CONFIG_KEY_0: "core.longpaths",
3433+
GIT_CONFIG_VALUE_0: "true",
3434+
});
3435+
}
3436+
});
3437+
34283438
it("reuses an inherited count whose name differs only in case", () => {
34293439
const result = windowsLongPathConfigEnv("win32", { git_config_count: "2" });
34303440

@@ -3446,7 +3456,7 @@ describe("windowsLongPathConfigEnv", () => {
34463456
});
34473457

34483458
it("leaves a malformed count alone so git still reports it", () => {
3449-
for (const malformed of ["not-a-number", "2x", "-1", "1.5", " ", "1 ", "1\n"]) {
3459+
for (const malformed of ["not-a-number", "2x", "-1", "-01", "1.5", " ", "1 ", "1\n"]) {
34503460
assert.deepStrictEqual(
34513461
windowsLongPathConfigEnv("win32", {
34523462
GIT_CONFIG_COUNT: malformed,

‎apps/server/src/vcs/VcsProcess.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export const windowsLongPathConfigEnv = (
146146
if (
147147
inherited !== undefined &&
148148
inherited !== "" &&
149-
/^[ \t\r\n\v\f]*\+?\d+/.exec(inherited)?.[0] !== inherited
149+
/^[ \t\r\n\v\f]*(?:\+?\d+|-0+)/.exec(inherited)?.[0] !== inherited
150150
) {
151151
return {};
152152
}

0 commit comments

Comments
 (0)