Skip to content

fix(core): support older Git in untracked diff batching - #56527

Closed
langgexyz wants to merge 2 commits into
anomalyco:devfrom
langgexyz:storm-vcs-batch-fix
Closed

langgexyz wants to merge 2 commits into
anomalyco:devfrom
langgexyz:storm-vcs-batch-fix

Conversation

@langgexyz

@langgexyz langgexyz commented Oct 17, 2026 •

Copy link
Copy Markdown

Summary

  • Retry batched untracked-file staging without git add --sparse when the installed Git rejects that option.
  • Preserve the per-file fallback when compatible batch staging still fails.

Evidence

  • On Apple Git 2.50.1, git add --sparse exits 129 (unknown option 'sparse'). The batch then silently fell back to per-file commands, spawning 137 Git processes for 40 untracked files.
  • The existing batching regression test now passes on this Git version.

Verification

  • bun script/test.ts --test-name-pattern 'batches untracked files without spawning Git per file or touching the index' — pass.
  • bun run typecheck in packages/core — pass.
  • bun script/test.ts in packages/core — 6,646 pass, 43 skip, 0 fail.

Added by the opencode bot (AI-generated).

Related: #52953

@github-actions github-actions Bot added needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Oct 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 72 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@opencode-agent opencode-agent Bot 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.

Looks good. I verified it with a wrapper that makes git reject --sparse with exit 129, the way older Git does. On the base, the batching regression test then fails with 137 spawned Git processes for 40 files. With this PR it passes, and so does the rest of test/vcs.test.ts. With an unmodified Git (2.47.3), test/vcs.test.ts passes on both base and PR, and typecheck in packages/core passes.

The PR now returns early when git add fails for a reason other than 129. Before, the exit code was ignored. When a listed file has disappeared, for example, Git exits 128 and writes nothing, so the base already ended up in the per-file fallback anyway. This just skips two wasted git diff runs.

One question about the description, not a blocker: Git 2.47 accepts add --sparse, so Apple Git 2.50.1 almost certainly does too. Was the exit 129 maybe from a different, older git earlier in your PATH? The fix is still correct for Git versions without the option.

Public API: unchanged (internal Git invocation only).

Related: #52953

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 72-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Oct 20, 2026
@github-actions github-actions Bot closed this Oct 20, 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.

1 participant