Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

Mergedahalekelly(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/14718/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 1 changed file with 9 additions and 4 deletions.

x
0 of 1 viewed, 1 left
9 additions and 4 deletionsapps/server/src/vcs/GitVcsDriverCore.tsModified
View file
@@ -860,6 +860,9 @@
cwd: commandInput.cwd,
env: {
...process.env,
+ // Status polling runs beside the user's own git commands; without this,
+ // `git status` takes index.lock to save its refreshed index.
+ GIT_OPTIONAL_LOCKS: "0",
...input.env,
...trace2Monitor.env,
@@ -1771,10 +1774,12 @@
const statusCacheKey = repositoryPaths?.gitCommonDir;
const [numstatStdout, defaultBranch, hasPrimaryRemote] = yield* Effect.all(
+ // Plumbing, because porcelain `git diff` rewrites the index even with
+ // GIT_OPTIONAL_LOCKS=0. -M keeps porcelain's rename detection.
executeGitWithStableDiagnostics(
"GitVcsDriver.statusDetails.numstat",
- ["diff", "HEAD", "--numstat", "--"],
+ ["diff-index", "-M", "--numstat", "HEAD", "--"],
Thread on line 1782
macroscopeapp[bot](GitHub profile, opens in a new tab)commented

🟡 Medium vcs/GitVcsDriverCore.ts:1782

Status reports zero insertions/deletions for files handled by configured textconv drivers, even when the converted content has changes. git diff-index does not enable textconv by default, unlike the replaced git diff; pass --textconv to preserve the previous statistics.

🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/server/src/vcs/GitVcsDriverCore.ts around line 1782:

Status reports zero insertions/deletions for files handled by configured textconv drivers, even when the converted content has changes. `git diff-index` does not enable textconv by default, unlike the replaced `git diff`; pass `--textconv` to preserve the previous statistics.

🤖 Generated with Claude Code

False positive: porcelain git diff --numstat doesn't apply textconv either; textconv only affects patch output. Checked on git 2.56. With an uppercasing textconv driver, a→A gives 1 1 from both git diff HEAD --numstat and git diff-index -M --numstat HEAD. With a strings driver on a binary file, both report - - (--stat shows Bin 12 -> 12 bytes). So diff-index produces the same counts as before, and adding --textconv doesn't change them.

macroscopeapp[bot](GitHub profile, opens in a new tab)commented

Sorry, I'm unable to act on this request because you do not have permissions within this repository.

{ allowNonZeroExit: true },
).pipe(
Effect.flatMap((result) => {
@@ -1783,7 +1788,7 @@
return Effect.map(
Effect.all([