ZIm/crates/git/src
Oleksiy Syvokon 9da9ef860b
agent: Don't track large and common binary files (#31352)
## Issue

The agent may run very slowly on projects that contain many or large
binary files not listed in `.gitignore`.


## Solution

Temporarily rewrite `.git/info/exludes` to ignore:
- Common binary files based on the extension
- Files larger than 2 MB

## Benchmark

I measure the time between sending an agent message in UI ("hitting
Enter") and actually sending it to an LLM. Ideally, it should be
instant. Numbers for a 7.7 GB Rust project with no .gitignore.

Filter                            | Time
----------------------------------|-----
No filter (= before this change)  | 62 s
Exclude common file types only    | 1.46 s
Exclude files >2MB only           | 1.16 s
Exclude both                      | 0.10 s


## Planned changes:

- [x] Exclude common binary file types
- [x] Exclude large files
- [ ] Track files added by agent so we could delete them (we can't rely
on git for that anymore)
- [ ] Don't block on waiting for a checkpoint to complete until we
really need it
- [ ] Only `git add` files that are about to change


Closes #ISSUE

Release Notes:

- Improved agent latency on repositories containing many files or large
files
2025-05-26 11:31:25 +00:00
..
blame.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
checkpoint.gitignore agent: Don't track large and common binary files (#31352) 2025-05-26 11:31:25 +00:00
commit.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
git.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
hosting_provider.rs Allow viewing past commits in Zed (#27636) 2025-03-31 23:26:47 +00:00
remote.rs Detect wider variety of usernames for SSH-based remotes (#21508) 2024-12-05 15:23:37 -08:00
repository.rs agent: Don't track large and common binary files (#31352) 2025-05-26 11:31:25 +00:00
status.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00