authorgravatar for 7078138+ahalekelly@users.noreply.github.comahalekelly <7078138+ahalekelly@users.noreply.github.com> 2026-10-05 21:12:18-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-10-06 04:12:18+00:00
log447046b589140a50a4a782453133da83ff77e85e
tree8dc57a1c19aa55fbd84bd3f6e68e9142f53a66aa
parent570b72d83978f718a5e677002bde3abe55a6d797
signature Signed by PGP key B5690EEEBB952194

fix(server): status polling no longer locks the git index (#14718)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

1 files changed, 9 insertions(+), 4 deletions(-)

apps/server/src/vcs/GitVcsDriverCore.ts+9-4
......@@ -931,6 +931,9 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
931931 cwd: commandInput.cwd,
932932 env: {
933933 ...process.env,
934 // Status polling runs beside the user's own git commands; without this,
935 // `git status` takes index.lock to save its refreshed index.
936 GIT_OPTIONAL_LOCKS: "0",
934937 ...input.env,
935938 ...trace2Monitor.env,
936939 },
......@@ -1875,10 +1878,12 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
18751878 const statusCacheKey = repositoryPaths?.gitCommonDir;
18761879 const [numstatStdout, defaultBranch, hasPrimaryRemote] = yield* Effect.all(
18771880 [
1881 // Plumbing, because porcelain `git diff` rewrites the index even with
1882 // GIT_OPTIONAL_LOCKS=0. -M keeps porcelain's rename detection.
18781883 executeGitWithStableDiagnostics(
18791884 "GitVcsDriver.statusDetails.numstat",
18801885 cwd,
1881 ["diff", "HEAD", "--numstat", "--"],
1886 ["diff-index", "-M", "--numstat", "HEAD", "--"],
18821887 { allowNonZeroExit: true },
18831888 ).pipe(
18841889 Effect.flatMap((result) => {
......@@ -1887,7 +1892,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
18871892 return Effect.map(
18881893 Effect.all([
18891894 runGitStdout("GitVcsDriver.statusDetails.numstat.unborn", cwd, [
1890 "diff",
1895 "diff-files",
18911896 "--numstat",
18921897 ]),
18931898 runGitStdout("GitVcsDriver.statusDetails.numstat.unborn.staged", cwd, [
......@@ -1920,9 +1925,9 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
19201925 ...gitCommandContext({
19211926 operation: "GitVcsDriver.statusDetails.numstat",
19221927 cwd,
1923 args: ["diff", "HEAD", "--numstat", "--"],
1928 args: ["diff-index", "-M", "--numstat", "HEAD", "--"],
19241929 }),
1925 detail: "git diff HEAD --numstat failed.",
1930 detail: "git diff-index HEAD --numstat failed.",
19261931 exitCode: result.exitCode,
19271932 stdoutLength: result.stdout.length,
19281933 stderrLength: result.stderr.length,