[PR #12876] fix: separate ignore instances for .gitignore and .ignore #14418

Open
opened 2026-02-16 18:19:12 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/12876

State: open
Merged: No


What does this PR do?

Fixes #4739

This fixes File.list() to process .gitignore and .ignore separately instead of merging them into a single ignore instance. This allows .ignore negation patterns (e.g. !/foo/) to override .gitignore rules, matching the intended behavior where .ignore controls what tools like the filepicker show independently of what git tracks.

My use case is to ignore git repos inside another git repo but still be able to traverse them in the filepicker.

An example of what this pull request enables:

.gitignore:

/repositories/*

.ignore:

!/repositories/
!/repositories/**
/repositories/**/.git/
/repositories/**/node_modules/

This is useful in a workspace that isn't a monorepo but that manages a set of repositories. There are probably other use cases for the changes in this pull request, things like having gitignored sandbox or tmp directories where we still want to easily reference the contents.

How did you verify your code works?

Ran tests to make sure nothing broke and launched using bun dev path/to/project/ where i had .gitignore and .ignore files set up like above.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12876 **State:** open **Merged:** No --- ### What does this PR do? Fixes #4739 This fixes File.list() to process .gitignore and .ignore separately instead of merging them into a single ignore instance. This allows .ignore negation patterns (e.g. !/foo/) to override .gitignore rules, matching the intended behavior where .ignore controls what tools like the filepicker show independently of what git tracks. My use case is to ignore git repos inside another git repo but still be able to traverse them in the filepicker. An example of what this pull request enables: .gitignore: ``` /repositories/* ``` .ignore: ``` !/repositories/ !/repositories/** /repositories/**/.git/ /repositories/**/node_modules/ ``` This is useful in a workspace that isn't a monorepo but that manages a set of repositories. There are probably other use cases for the changes in this pull request, things like having gitignored sandbox or tmp directories where we still want to easily reference the contents. ### How did you verify your code works? Ran tests to make sure nothing broke and launched using `bun dev path/to/project/` where i had .gitignore and .ignore files set up like above.
yindo added the pull-request label 2026-02-16 18:19:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14418