Skip to content

fix(snapshot): avoid ENAMETOOLONG and improve staging perf via stdin pathspecs - #22560

Merged
Hona merged 5 commits into
anomalyco:devfrom
Hona:fix-enametoolong-snapshots
Apr 15, 2026
Merged

fix(snapshot): avoid ENAMETOOLONG and improve staging perf via stdin pathspecs#22560
Hona merged 5 commits into
anomalyco:devfrom
Hona:fix-enametoolong-snapshots

Conversation

@Hona

@Hona Hona commented Apr 15, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 15, 2026 05:11

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.

Pull request overview

Updates the snapshot gitignore-filtering implementation to avoid command-line length limits (ENAMETOOLONG) by passing large file lists to git via stdin, and adds a regression test to cover large tracked sets.

Changes:

  • Add stdin support to the internal git(...) helper and introduce helpers to feed NUL-delimited file lists.
  • Switch git check-ignore and git rm --cached calls to use --stdin -z / --pathspec-from-file=- --pathspec-file-nul.
  • Add a snapshot test that exercises gitignore filtering with a large number of tracked files.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/opencode/src/snapshot/index.ts Uses stdin-fed NUL-delimited file lists for check-ignore and rm to prevent ENAMETOOLONG.
packages/opencode/test/snapshot/snapshot.test.ts Adds a regression test ensuring large tracked sets are filtered correctly without hitting argv limits.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/opencode/test/snapshot/snapshot.test.ts Outdated
Comment thread packages/opencode/test/snapshot/snapshot.test.ts Outdated
@Hona
Hona requested a review from Copilot April 15, 2026 06:21
@Hona

Hona commented Apr 15, 2026

Copy link
Copy Markdown
Member Author

/review

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.

Pull request overview

Updates the snapshot subsystem’s Git interactions to avoid command-line length limits by passing path lists via stdin, improving reliability for large change sets.

Changes:

  • Add a reusable stdin feeder (feed) and extend the local git() helper to accept stdin.
  • Replace git check-ignore -- <files…> with git check-ignore --stdin -z and centralize ignore handling in ignore().
  • Replace git rm/add -- <files…> flows with --pathspec-from-file=- --pathspec-file-nul and stage only the candidate set.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/opencode/src/snapshot/index.ts Outdated
{ concurrency: 8 },
)).filter((item): item is string => Boolean(item)),
)
yield* sync(Array.from(large))
Comment on lines +162 to +170
const stage = Effect.fnUntraced(function* (files: string[]) {
if (!files.length) return
const result = yield* git(
[...cfg, ...args(["add", "--all", "--sparse", "--pathspec-from-file=-", "--pathspec-file-nul"])],
{
cwd: state.directory,
stdin: feed(files),
},
)
@Hona Hona changed the title fix(snapshot): Avoid ENAMETOOLONG by using stdin file list fix(snapshot): avoid ENAMETOOLONG and improve staging perf via stdin pathspecs Apr 15, 2026
@Hona
Hona enabled auto-merge (squash) April 15, 2026 06:41
@Hona
Hona merged commit a992d8b into anomalyco:dev Apr 15, 2026
10 checks passed
jwcrystal pushed a commit to jwcrystal/opencode that referenced this pull request Apr 15, 2026
cmaloney111 pushed a commit to psi-oss/gpd-app that referenced this pull request Apr 20, 2026
sdeonvacation pushed a commit to sdeonvacation/opencode-x-old that referenced this pull request Apr 23, 2026
xywsxp pushed a commit to xywsxp/opencode that referenced this pull request Apr 24, 2026
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
avion23 pushed a commit to avion23/opencode that referenced this pull request Jun 10, 2026
isaacfinnegan pushed a commit to isaacfinnegan/whispercode that referenced this pull request Jun 15, 2026
MarsQiu007 referenced this pull request in MarsQiu007/openNovel Jul 31, 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.

2 participants