Repository navigation
Git diff chip counts lines of untracked files marked -diff in .gitattributes #16611
Description
Pre-submit Checks
- I have searched Warp bugs and there are no duplicates
- I have searched Warp known issues page and my issue is not there
- I have an issue with AI and have included the debugging ID (Optional, but helps expedite the AI quality fix). Debugging ID instructions
- I have technical issue and have included the logs (optional, but helps expedite the bug fix). Log instructions
Describe the bug
The git diff stats (top-right "± button" and the prompt git chip) count every line of untracked files that .gitattributes marks as -diff (or binary). The Code Review panel correctly excludes them, so the two disagree.
Example: a long, newly generated migration file or log is marked -diff. The Code Review panel shows +28 -0, but the ± button and the prompt chip show +2540 -0.
Cause: for untracked files, the stats read the file from disk and count its lines, which ignores git attributes. The Code Review panel uses git diff, which respects -diff and treats the file as binary (0 lines). Tracked files are not affected, because git diff --numstat already respects attributes.
Possibly related: #12212
To reproduce
- In a git repo, add this line to
.gitattributes: generated.txt -diff - Create the file without staging it:
seq 1 2500 > generated.txt - Look at the ± button in the top-right and the git diff chip in the prompt -> it includes the 2500 lines.
- Open the Code Review panel -> generated.txt is excluded from the line count.
Expected behavior
The ± button and the prompt git chip show the same totals as the Code Review panel, excluding untracked files whose diff attribute is unset.
Screenshots, videos, and logs
Operating system (OS)
macOS
Operating system and version
macOS 27.0.1
Shell Version
zsh 5.9
Current Warp version
v0.2026.10.14.08.27.stable_02
Regression
No, this bug or issue has existed throughout my experience using Warp
Recent working Warp date
No response
Additional context
No response
Does this block you from using Warp daily?
No
Is this an issue only in Warp?
Yes, I confirmed that this only happens in Warp, not other terminals.
Warp Internal (ignore): linear-label:b9d78064-c89e-4973-b153-5178a31ee54e
None
Activity
warp-for-oss commentedon Oct 22, 2026
@Ga-3tan
Here's what I found while triaging this issue:
The report has enough detail to reproduce, and the behavior matches Warp's current Git diff stats code path. The expected fix is for the prompt/top-right diff stats to respect Git attributes for untracked files the same way the Code Review panel does.
I've flagged this for the factory auto-implement queue.
Maintainer details
I concluded that untracked files marked
-diffor binary in.gitattributesare counted by Warp's git diff stats metadata even though the Code Review diff path treats them as binary, causing the prompt/top-right diff counts to disagree with the Code Review panel..Triage summary
This looks like a real bug in the Git diff stats shown outside the Code Review panel. The reporter's explanation matches the current code path: untracked files are enumerated separately from
git diff --numstat HEAD, and when there is no numstat row for an untracked file Warp falls back to directly counting working-tree lines.Reproducibility
High. The issue includes minimal reproduction steps, screenshots, and environment details. A local Git check with an untracked
generated.txtmarked-diffshows thatgit diff --numstat HEADproduces no entry, whilegit diff --no-index /dev/null generated.txttreats the file as binary because thediffattribute is unset.Likely root cause
app/src/code_review/diff_state/local.rscomputes aggregate diff metadata indiff_metadata_against_headanddiff_metadata_against_specific_branch. For untracked files missing fromgit diff --numstat, it callsnum_lines_in_file_if_non_binary, which only inspects file bytes and size and does not consult.gitattributes.app/src/code_review/git_repo_model/local.rsfeeds those aggregate stats intoGitStatusMetadata, andapp/src/context_chips/current_prompt.rs/app/src/context_chips/display_chip.rsrender that metadata in the prompt diff chip. The Code Review diff view uses a separate per-file path that runsgit diff --no-indexfor untracked files and therefore treats the-difffile as binary, so the displayed totals can diverge.Duplicate check
I found related open reports about stale or inconsistent Git diff chips, including #12212, #15209, #16319, #9787, #12664, and #12674, but none of the scanned open issues or recently closed issues matched the specific
.gitattributes -diff/ untracked-file line-count scenario closely enough to mark this as a duplicate under the two-candidate duplicate threshold.Factory auto-implementation
Eligible. The behavior is a client-side bug with high reproducibility, a known root cause, an unambiguous definition of done, and a localized fix path in Git diff metadata handling.
This is my automated analysis and may be incorrect. A maintainer will verify the details.
Powered by Oz