fix(server): handle files named HEAD in git status - #6397
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved cdfbeee Straightforward bug fix using standard git conventions. Adds You can customize Macroscope's approvability policy. Learn more. |
What Changed
Disambiguate
HEADas a Git revision when collecting working-tree numstat data. The status path now terminates revision arguments with--and preserves the existing fallback for repositories that do not have an initial commit yet.A focused integration test creates and modifies a tracked file named
HEAD, then verifies thatGitVcsDriver.statusDetails()reports its line counts.Why
git diff HEAD --numstattreatsHEADas ambiguous when the worktree also contains a file with that name, causing Git status collection to fail with exit code 128. The explicit revision/path boundary keeps valid repositories reportable without changing normal status behavior.Validation
node_modules/.bin/vp test run apps/server/src/vcs/GitVcsDriverCore.test.ts— 48 passednode_modules/.bin/vp run --filter t3 typecheckChecklist
Implemented with OpenAI GPT-5.6 through the Codex harness in T3 Code.
Note
Fix
git diff HEAD --numstatto handle files named HEAD in git status--to thegit diff HEAD --numstatinvocation instatusDetails, preventing Git from misinterpreting path tokens and allowing files literally namedHEADto appear in working tree changes.isUnbornHeadStderrin GitVcsDriverCore.ts to also match"bad revision 'head'"(case-insensitive), covering an additional Git error variant for unborn HEAD detection.Macroscope summarized cdfbeee.
Note
Low Risk
Narrow VCS status fix with a regression test; normal repos are unchanged aside from the explicit
--on the diff invocation.Overview
Fixes Git status collection when the worktree contains a tracked file named
HEAD.statusDetailsnow runsgit diff HEAD --numstatwith a trailing--so Git treatsHEADas the revision, not a pathspec.isUnbornHeadStderralso recognizesbad revision 'head', so the existing unborn-HEAD numstat fallback still applies when appropriate.An integration test commits a file named
HEAD, modifies it, and assertsstatusDetailsreports the path and line counts.Reviewed by Cursor Bugbot for commit cdfbeee. Bugbot is set up for automated code reviews on this repo. Configure here.