Skip to content
Merged
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
13 changes: 9 additions & 4 deletions apps/server/src/vcs/GitVcsDriverCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,9 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
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,
},
Expand Down Expand Up @@ -1771,10 +1774,12 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
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",
cwd,
["diff", "HEAD", "--numstat", "--"],
["diff-index", "-M", "--numstat", "HEAD", "--"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

{ allowNonZeroExit: true },
).pipe(
Effect.flatMap((result) => {
Expand All @@ -1783,7 +1788,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
return Effect.map(
Effect.all([
runGitStdout("GitVcsDriver.statusDetails.numstat.unborn", cwd, [
"diff",
"diff-files",
"--numstat",
]),
runGitStdout("GitVcsDriver.statusDetails.numstat.unborn.staged", cwd, [
Expand Down Expand Up @@ -1816,9 +1821,9 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
...gitCommandContext({
operation: "GitVcsDriver.statusDetails.numstat",
cwd,
args: ["diff", "HEAD", "--numstat", "--"],
args: ["diff-index", "-M", "--numstat", "HEAD", "--"],
}),
detail: "git diff HEAD --numstat failed.",
detail: "git diff-index HEAD --numstat failed.",
exitCode: result.exitCode,
stdoutLength: result.stdout.length,
stderrLength: result.stderr.length,
Expand Down
Loading