Skip to content

fix(vcs): batch untracked diff checks#35997

Closed
HOYALIM wants to merge 1 commit into
anomalyco:devfrom
HOYALIM:codex/vcs-diff-batch-untracked
Closed

fix(vcs): batch untracked diff checks#35997
HOYALIM wants to merge 1 commit into
anomalyco:devfrom
HOYALIM:codex/vcs-diff-batch-untracked

Conversation

@HOYALIM

@HOYALIM HOYALIM commented Jul 9, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #34916

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When a repository has no HEAD, VCS diff collection handled each untracked file separately. This adds a batched untracked diff path using a temporary git index and git add --intent-to-add --pathspec-from-file=- --pathspec-file-nul, then collects patch and numstat output in batches.

Impact: no-HEAD untracked diff collection moves from per-file git subprocesses to a fixed small number of git calls.

How did you verify your code works?

  • bun test test/project/vcs.test.ts --timeout 30000 from packages/opencode
  • bun typecheck from packages/opencode
  • bun lint packages/opencode/src/project/vcs.ts packages/opencode/src/git/index.ts packages/opencode/test/project/vcs.test.ts
  • git diff --check HEAD~1..HEAD

Screenshots / recordings

N/A, non-UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Signed-off-by: Ho Lim <subhoya@gmail.com>
Copilot AI review requested due to automatic review settings July 9, 2026 01:37

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

CreatorGhost added a commit to CreatorGhost/TheCode that referenced this pull request Jul 12, 2026
CreatorGhost added a commit to CreatorGhost/TheCode that referenced this pull request Jul 12, 2026
CreatorGhost added a commit to CreatorGhost/TheCode that referenced this pull request Jul 12, 2026
* fix(vcs): batch untracked diff checks

Ported from upstream anomalyco#35997.

* fix(vcs): fail closed on intent-to-add error + test no-HEAD special filenames

Addresses Opus review of PR #15: guard diffUntracked against a failed
intent-to-add (return empty batch so caller falls back to per-file native
patches) and add a no-HEAD untracked test exercising NUL-pathspec escaping.
@HOYALIM

HOYALIM commented Jul 13, 2026

Copy link
Copy Markdown
Author

Closing to reduce WIP and rework the scope. The temporary-index implementation expands the Git/VCS surface substantially and needs a benchmark plus stronger special-path, truncation, and cleanup coverage before review.

@HOYALIM HOYALIM closed this Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Diff viewer hangs on "Loading diff..." with many untracked files (per-file git subprocess in Vcs.diff)

2 participants