Description
Untracked files marked -diff (or binary) in .gitattributes were counted line by line in the git diff stats (prompt git diff chip and the top-right ± button), while the Code Review panel treated them as binary. In my case, a long generated migration file made the chip show +2540 while the Code Review panel showed +28.
Cause: for untracked files, git diff --numstat has no row, so the stats fall back to reading the file from disk and counting lines. That fallback ignores git attributes. The Code Review panel uses git diff --no-index, which respects them.
Fix:
- New helper
paths_with_diff_attr_unset(app/src/util/git.rs) runsgit check-attr -z diffon the untracked paths (chunked) and returns those withdiffunset. - Every place that counts untracked lines skips those paths:
diff_metadata_against_headanddiff_metadata_against_specific_branch(app/src/code_review/diff_state/local.rs) → prompt chip, ± button, branch stats.get_repo_git_summaryandget_file_change_entries(app/src/util/git.rs) → repos menu, per-file lists.get_diff_for_commit_message→ content of-diffuntracked files is no longer sent for AI commit messages.
- Untracked paths in
app/src/util/git.rsare now read withls-files -z, so non-ASCII names are not C-quoted and matchcheck-attroutput.
Known limit: a custom diff driver with binary = true in git config (diff=<driver>) is not detected; only an unset diff attribute is.
Linked Issue
Fixes #16611
- The linked issue is labeled
ready-to-specorready-to-implement. - Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).
Testing
-
Added
repo_git_summary_skips_untracked_files_with_diff_unsetinapp/src/util/git_tests.rs: an untracked*.sqlfile marked-diffis not counted. -
cargo nextest run -p warp --lib util::gitpasses. -
cargo clippy -p warp --bin warp-oss --tests -- -D warningspasses. -
./script/presubmit: format, clippy, clang-format and wgslfmt pass. 13027/13036 tests pass; the 9 failures are environment-only and unrelated to this change:- 6 SSH integration tests (
test_ssh_*,test_cloud_agent_shell_respawn) need Warp's internal GCP IAP access (not authorized). - 3
remote_server::...::remote_move_*tests fail only under the full parallel run (they receive aRemoteAgentContextSnapshotbuilt from local~/.claude/skills); they pass when run on their own.
- 6 SSH integration tests (
-
Manually tested with
./script/runon macOS: with an untracked migration file marked-diff, the prompt chip and the ± button now match the Code Review panel. -
I have manually tested my changes locally with
./script/run
Screenshots / Videos
Before (± button and prompt chip count the -diff file; Code Review panel does not):
After (counts exclude the -diff file):
Agent Mode
- Warp Agent Mode - This PR was created via Warp's AI Agent Mode
CHANGELOG-BUG-FIX: Git diff stats in the prompt chip and the top-right diff button no longer count lines of untracked files marked -diff or binary in .gitattributes.
🤖 Generated with Claude Code
Activity
5@cla-bot check
The cla-bot has been summoned, and re-checked this pull request!
This pull request is a draft
Merging is unavailable until it is marked ready for review.
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @Ga-3tan on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment
@cla-bot checkto trigger another check.