Skip to content

git: Add support for repository excludes file#42082

Merged
cole-miller merged 8 commits intozed-industries:mainfrom
errmayank:feat-git-repo-exclude
Dec 16, 2025
Merged

git: Add support for repository excludes file#42082
cole-miller merged 8 commits intozed-industries:mainfrom
errmayank:feat-git-repo-exclude

Conversation

@errmayank
Copy link
Copy Markdown
Contributor

@errmayank errmayank commented Nov 6, 2025

Closes #4824

Release Notes:

  • Added support for Git repository excludes file .git/info/exclude
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Nov 6, 2025
@errmayank errmayank force-pushed the feat-git-repo-exclude branch from 215bf02 to 7b35c58 Compare November 9, 2025 16:19
@errmayank errmayank marked this pull request as ready for review November 9, 2025 16:19
@errmayank errmayank force-pushed the feat-git-repo-exclude branch from 7b35c58 to 85eac99 Compare November 10, 2025 10:16
@errmayank errmayank force-pushed the feat-git-repo-exclude branch from d0638e4 to 0950f1c Compare November 11, 2025 18:30
@errmayank errmayank force-pushed the feat-git-repo-exclude branch 3 times, most recently from 52d34a8 to 2333c0b Compare November 11, 2025 19:11
@errmayank
Copy link
Copy Markdown
Contributor Author

@cole-miller ready for review :)

Copy link
Copy Markdown
Member

@cole-miller cole-miller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! This looks really good, I just have one minor comment.

Comment thread crates/worktree/src/ignore.rs
@cole-miller
Copy link
Copy Markdown
Member

Thanks! I tried running this locally and it looks like changes to .git/info/exclude do not propagate to the Zed ignore statuses. Rereading the code, it seems like repo_exclude_by_work_directory_abs_path probably needs to track needs_update like ignores_by_parent_abs_path already does. It looks like the test was meant to cover this, but right now it asserts that .env.example is still tracked after adding it to .git/info/exclude, which is the opposite of the behavior we want.

@errmayank
Copy link
Copy Markdown
Contributor Author

Thanks! I tried running this locally and it looks like changes to .git/info/exclude do not propagate to the Zed ignore statuses. Rereading the code, it seems like repo_exclude_by_work_directory_abs_path probably needs to track needs_update like ignores_by_parent_abs_path already does.

I see, from my manual tests it seemed to work. Can you tell me how you debug the ignore statuses in Zed? I'll check how ignores_by_parent_abs_path does it. Thanks!

It looks like the test was meant to cover this, but right now it asserts that .env.example is still tracked after adding it to .git/info/exclude, which is the opposite of the behavior we want.

I think the test could be a bit clearer, but .env.example is asserted as tracked coz .gitignore still has !.env.example and local .gitignore has higher priority.

@cole-miller
Copy link
Copy Markdown
Member

cole-miller commented Nov 19, 2025

I tested by cloning the https://github.com/agentclientprotocol/agent-client-protocol repo, adding README.md to .git/info/exclude, and opening Zed---this causes README.md to have a faded appearance in the project panel (depending on the theme):

image

Then I did echo '' >.git/info/exclude from the terminal. After that, README.md still shows as faded in the project panel, but if I restart Zed it appears normal. So .git/info/exclude is being applied correctly at startup, but when it changes it seems like we're not recomputing the ignore statuses for the repo.

I think the test could be a bit clearer, but .env.example is asserted as tracked coz .gitignore still has !.env.example and local .gitignore has higher priority.

My mistake, thanks for pointing that out--seems like the test is correct then, I'm sort of surprised it does since it seems like the code for recomputing ignore statuses when .git/info/exclude changes isn't there right now. Maybe something else is causing us to recompute ignore statuses in the test?

@errmayank errmayank force-pushed the feat-git-repo-exclude branch from 2d89060 to e411012 Compare November 21, 2025 18:48
@errmayank
Copy link
Copy Markdown
Contributor Author

I realized that I only tested this for untracked files before and weirdly even that didn't seem to work properly, my bad.

I've added updates and it seems to work fine now, tested it on agent-client-protocol repository.

Here's the before/after:

screen-recording-repo-exclude.mov

Maybe something else is causing us to recompute ignore statuses in the test?

Hmm, I'm not sure about that either.

@esthertrapadoux
Copy link
Copy Markdown
Contributor

Hey @errmayank just following up to let you know the team went pretty deep in more git feature work and we got behind on PR reviews. We're ramping back up and appreciate the patience! 👍

@errmayank
Copy link
Copy Markdown
Contributor Author

@esthertrapadoux no worries at all, thanks for letting me know! :)

@errmayank errmayank force-pushed the feat-git-repo-exclude branch 3 times, most recently from 4d14d48 to be72707 Compare December 8, 2025 06:15
@errmayank errmayank force-pushed the feat-git-repo-exclude branch from be72707 to 2ff243a Compare December 8, 2025 06:56
@cole-miller
Copy link
Copy Markdown
Member

Thanks @errmayank!

@cole-miller cole-miller enabled auto-merge (squash) December 11, 2025 16:00
@errmayank
Copy link
Copy Markdown
Contributor Author

I'm not sure why editor_tests::test_outdent_after_input_for_bash is failing consistently on Linux. Seems totally unrelated.

For @cameron1024 as well it failed locally during our pairing session.

auto-merge was automatically disabled December 13, 2025 10:35

Head branch was pushed to by a user without write access

@errmayank errmayank force-pushed the feat-git-repo-exclude branch from 2ff243a to 250c360 Compare December 13, 2025 10:35
@cole-miller cole-miller force-pushed the feat-git-repo-exclude branch from be7f92d to 5b25440 Compare December 16, 2025 00:48
@cole-miller
Copy link
Copy Markdown
Member

Sorry about that flaky test failure! I'll try to figure out what's going on with it and get this merged.

@errmayank
Copy link
Copy Markdown
Contributor Author

Thanks!

Co-authored-by: Cole Miller <cole@zed.dev>
@cole-miller cole-miller enabled auto-merge (squash) December 16, 2025 16:22
@cole-miller cole-miller self-requested a review December 16, 2025 18:08
@cole-miller cole-miller merged commit 93d79f3 into zed-industries:main Dec 16, 2025
23 checks passed
@github-project-automation github-project-automation Bot moved this from Community PRs to Done in Quality Week – December 2025 Dec 16, 2025
HactarCE pushed a commit that referenced this pull request Dec 17, 2025
Closes #4824

Release Notes:

- Added support for Git repository excludes file `.git/info/exclude`

---------

Co-authored-by: Cole Miller <m@cole-miller.net>
Co-authored-by: Cole Miller <cole@zed.dev>
@esthertrapadoux esthertrapadoux moved this to 🚢 Shipped by Community in Git board Dec 18, 2025
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
Closes zed-industries#4824

Release Notes:

- Added support for Git repository excludes file `.git/info/exclude`

---------

Co-authored-by: Cole Miller <m@cole-miller.net>
Co-authored-by: Cole Miller <cole@zed.dev>
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
Closes zed-industries#4824

Release Notes:

- Added support for Git repository excludes file `.git/info/exclude`

---------

Co-authored-by: Cole Miller <m@cole-miller.net>
Co-authored-by: Cole Miller <cole@zed.dev>
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Feb 15, 2026
Closes zed-industries#4824

Release Notes:

- Added support for Git repository excludes file `.git/info/exclude`

---------

Co-authored-by: Cole Miller <m@cole-miller.net>
Co-authored-by: Cole Miller <cole@zed.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

4 participants