Skip to content

Git diff chip flickers between tracked-only and all-files count when untracked files are present #9228

@vkodithala

Description

@vkodithala

Summary

When running a terminal command in a repo that has both modified tracked files and untracked files, the git diff chip flickers between two values: the correct one that counts all changes (2 files | 8 edits) and an incorrect one that omits untracked files (1 file | 4 edits). The flicker is consistent and reproducible on every command run.

Problem

The GitDiffStats chip has two update paths that compute the file/edit counts differently:

  1. GitRepoStatusModel (filesystem watcher): calls DiffStateModel::diff_metadata_against_head(), which runs git status --untracked-files=all and reads line counts from untracked files directly. Includes untracked files.
  2. shell_git_line_changes() (shell fallback): runs GIT_OPTIONAL_LOCKS=0 git -c diff.autoRefreshIndex=false diff --shortstat HEAD. Excludes untracked files.

When a command completes, the shell-command fallback fires and briefly overwrites the filesystem-watcher value with a count that omits untracked files. The filesystem watcher then fires again and restores the correct value, producing the visible flicker.

Expected behavior

The chip consistently shows the correct count that includes both modified tracked files and untracked files (2 | 8 in this reproduction case).

Actual behavior

Every time a command is run, the chip briefly flickers to the incorrect value (1 | 4), which excludes untracked files, before snapping back to the correct value (2 | 8).

Reproduction steps

  1. Open Warp in a local git repository.
  2. Create at least one modified tracked file with a few edits (e.g., add 4 lines to any tracked file).
  3. Create at least one untracked file in the same repo (e.g., touch scripts/repro.sh and add 4 lines).
  4. Observe the git diff chip in the prompt — it should show both files/edits (e.g., 2 | 8).
  5. Run any terminal command (e.g., echo hello, ls, git status).
  6. Watch the git diff chip: it briefly shows the lower, tracked-only value (e.g., 1 | 4) then corrects to 2 | 8.
  7. The flicker repeats every time a command is run.

Specific repo state used during reproduction:

  • Modified tracked file: .mcp.json (+4 lines, 0 deletions)
  • Untracked file: scripts/repro-mcp.sh (4 lines)
  • Correct chip value: 2 | 8
  • Incorrect (flickered) chip value: 1 | 4

Artifacts

Video with a repro: https://www.loom.com/share/b0f148fe1c004eb591ec82e4149fcace.

Warp version

Unknown (please fill in from Warp → About Warp)

Operating system

macOS

Possible source references

  • app/src/context_chips/builtins.rs (162-180): shell_git_line_changes() runs git diff --shortstat HEAD, which only counts tracked file changes and excludes untracked files — this is the source of the incorrect lower value.
  • app/src/code_review/diff_state.rs (1624-1665): diff_metadata_against_head() uses git status --untracked-files=all and reads line counts from untracked files — this produces the correct higher value.
  • app/src/context_chips/current_prompt.rs (1428-1472): filesystem-watcher update path that calls GitLineChanges::from_diff_stats(&metadata.stats_against_head) — correct path, but races with the shell command path on block completion.
  • app/src/context_chips/current_prompt.rs (1480-1492): is_updated_externally() guard that should suppress the periodic 30-second timer when GitRepoStatusModel is live — but does not appear to suppress the block-completion shell command trigger.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:shell-terminalTerminal input/output, shell integration, prompt behavior, and block rendering.bugSomething isn't working.os:macmacOS-specific behavior, regressions, or requests.ready-to-implementThe issue is ready for implementation work.repro:highThe report includes enough evidence that the issue appears highly reproducible.triagedIssue has received an initial automated triage pass.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions