Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 29, 2025

Binary files in JJ diffs were causing context to become too large for the AI model. This PR filters them out, outputting only a minimal notification line instead of the full binary content.

Changes

  • Binary detection: Added is_binary_content() using git's heuristic (null byte check in first 8KB)
  • Diff filtering: Modified get_jj_diff() and get_jj_diff_for_files() to skip binary content for added/deleted/modified files
  • Optimized reads: Check source file first; only read target if source is text (per review feedback)

Output for binary files

Binary file assets/logo.png added
Binary file images/screenshot.png modified
Binary file old-binary.dat deleted

Note on file selection

File selection for JJ already exists via decide_diff_jj() in util.rs - works identically to Git with --select-files flag or automatic prompt when token limit exceeded.

Original prompt

For JJ usage it should NOT include binary files in the diff it uses, because now whenever there is a bin file the context get's to obig of course. That at a minimum. Also just answer me, do we still have the feature to select files for the diff? I think we had that with git but not sure if we removed that fully or just support it for git right now, maybe research if that is also doable for jj


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Exclude binary files from JJ diff context Exclude binary files from JJ diffs Nov 29, 2025
Copilot AI requested a review from dikkadev November 29, 2025 18:10
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