fix(git): avoid optional status locks in watch mode#408
Conversation
Greptile SummaryThis PR fixes watch-mode index contention by prepending
Confidence Score: 5/5Safe to merge — the change is a one-line addition of a well-established Git global flag and an export modifier, with no behavioral risk to existing callers. The fix is minimal and correct: --no-optional-locks is placed before the subcommand as required, pathspec handling is unaffected, and the new test pins the exact argument order so any accidental reordering would be caught. All three changed files are clean. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant WatchPoller as Watch Mode Poller
participant listGitUntrackedFiles
participant buildGitStatusArgs
participant runGitText
participant Git as git process
WatchPoller->>listGitUntrackedFiles: poll for changes
listGitUntrackedFiles->>buildGitStatusArgs: input (VcsCommandInput)
buildGitStatusArgs-->>listGitUntrackedFiles: "["--no-optional-locks","status","--porcelain=v1","-z","--untracked-files=all"]"
listGitUntrackedFiles->>runGitText: args (with --no-optional-locks)
runGitText->>Git: "git --no-optional-locks status --porcelain=v1 -z --untracked-files=all"
Note over Git: No optional index lock acquired
Git-->>runGitText: NUL-separated porcelain output
runGitText-->>listGitUntrackedFiles: stdout
listGitUntrackedFiles-->>WatchPoller: untracked file paths
Reviews (1): Last reviewed commit: "fix(git): avoid optional status locks in..." | Re-trigger Greptile |
Summary
--no-optional-locksso watch polling does not refresh the index under an optional lock.Fixes #398.
Testing
bun test src/core/git.test.tsbun run typecheckbun testgitexecutable confirmedhunk diff --watchnow invokesgit --no-optional-locks status --porcelain=v1 -z --untracked-files=allfor status polling.This PR description was generated by Pi using OpenAI GPT-5