Add support for an additional exclusion file besides .gitignore and .geminiignore - #16487
Conversation
Summary of ChangesHello @alisa-alisa, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the file filtering mechanism by introducing support for a custom ignore file. This feature is essential for integrating with external tools, such as Gemini Code Assist, which may require specific exclusion patterns. By allowing a custom ignore file whose rules are prioritized, the system gains greater flexibility and control over which files are processed, without altering existing Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for a custom ignore file, which is a great feature. The implementation is mostly correct, but I found a critical issue in the file filtering logic that breaks the precedence rules for ignore patterns. The current implementation can cause files that should be un-ignored by the custom file to be incorrectly filtered out. I've provided a detailed comment with a suggested fix for this issue.
e96dda0 to
5696cf6
Compare
5696cf6 to
fc394ce
Compare
|
Hi @alisa-alisa, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this. We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines. Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed. Thank you for your understanding and for being a part of our community! |
81bd4f7 to
a91a44f
Compare
adamfweidman
left a comment
There was a problem hiding this comment.
overall looks good!
A few larger comments:
- Can we support multiple custom ignore file paths? customIgnoreFilePaths would be an optional array of strings (pattern precedence based on ordering in the array).
- Make this a configurable settings rather than just settable via env vars
|
This will address #4688 |
a91a44f to
6ff32cd
Compare
|
Addressed comments. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
The pull request introduces support for additional exclusion files beyond .gitignore and .geminiignore, configurable via customIgnoreFilePaths in settings and an environment variable. This enhancement centralizes ignore logic within FileDiscoveryService and ensures proper precedence for custom ignore patterns. Documentation and test cases have been updated to reflect these changes, including refactoring the GeminiIgnoreParser into a more generic IgnoreFileParser to handle multiple ignore file types. Review comments address minor test cleanup, a missing property in a test mock, and a potential robustness issue with parsing file paths from an environment variable.
…vice. Add it as an optional parameter for FileDiscoveryService constructor and pass it when called from A2A.
…a constructor parameter so that other files can be used.
The first in the list has priority over the last.
There was a problem hiding this comment.
Code Review
The pull request successfully introduces support for custom ignore files, enhancing the flexibility of file filtering within the CLI. The refactoring to use a generic IgnoreFileParser and centralizing the ignore logic within FileDiscoveryService is a significant improvement, promoting better maintainability and extensibility. The changes are well-tested and documented.
Updating the documentation to highlight the priorities.
Addressing merge conflicts with main.
…geminiignore (google-gemini#16487) Co-authored-by: Adam Weidman <adamfweidman@google.com>
…geminiignore (google-gemini#16487) Co-authored-by: Adam Weidman <adamfweidman@google.com>
…geminiignore (#16487) Co-authored-by: Adam Weidman <adamfweidman@google.com>
…geminiignore (google-gemini#16487) Co-authored-by: Adam Weidman <adamfweidman@google.com>
Summary
Adding ability to provide an additional exclusion file. It can be provided via a2a-server via an env variable
CUSTOM_IGNORE_FILE_PATH.Details
Support for additional ignore file types are needed to support capabilities such as Gemini Code Assist - Code Customization, which relies on .aiexclude, Users may wish to define their own code customization filename/patterns.
The file is required to take precedence over everything else what seems logical - if a third-party provides an exclusion, they might want to have it prioritized.
Not a breaking change.
Related Issues
Fixes #7439 #4688
How to Validate
Pre-Merge Checklist