Skip to content

Add support for an additional exclusion file besides .gitignore and .geminiignore - #16487

Merged
alisa-alisa merged 22 commits into
google-gemini:mainfrom
alisa-alisa:custom-ignore-file
Jan 28, 2026
Merged

Add support for an additional exclusion file besides .gitignore and .geminiignore#16487
alisa-alisa merged 22 commits into
google-gemini:mainfrom
alisa-alisa:custom-ignore-file

Conversation

@alisa-alisa

@alisa-alisa alisa-alisa commented Jan 13, 2026

Copy link
Copy Markdown
Contributor

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

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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 .gitignore or .geminiignore configurations.

Highlights

  • Custom Ignore File Support: Introduced the ability to specify an additional exclusion file via the CUSTOM_IGNORE_FILE_PATH environment variable, allowing for more flexible file filtering.
  • Prioritization of Custom Exclusions: The patterns defined in the custom ignore file now take precedence over existing .gitignore and .geminiignore rules, ensuring that third-party exclusions are respected.
  • Refactored Ignore File Parsing: The GeminiIgnoreParser has been refactored and renamed to a more generic IgnoreFileParser, making it reusable for different types of ignore files.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@gemini-cli gemini-cli Bot added priority/p3 Backlog - a good idea but not currently a priority. area/core Issues related to User Interface, OS Support, Core Functionality labels Jan 13, 2026
@alisa-alisa
alisa-alisa marked this pull request as ready for review January 14, 2026 08:04
@alisa-alisa
alisa-alisa requested a review from a team as a code owner January 14, 2026 08:04
@gemini-cli gemini-cli Bot added size/l A large sized PR review/involved PRs that may take a lot of work to review labels Jan 14, 2026
@bdmorgan

Copy link
Copy Markdown
Collaborator

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!

@adamfweidman adamfweidman self-assigned this Jan 15, 2026
@alisa-alisa
alisa-alisa force-pushed the custom-ignore-file branch 2 times, most recently from 81bd4f7 to a91a44f Compare January 20, 2026 14:43

@adamfweidman adamfweidman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Comment thread packages/core/src/services/fileDiscoveryService.ts Outdated
Comment thread packages/core/src/tools/ripGrep.ts Outdated
@adamfweidman

Copy link
Copy Markdown
Collaborator

This will address #4688

@alisa-alisa
alisa-alisa requested a review from a team as a code owner January 23, 2026 06:53
@alisa-alisa

Copy link
Copy Markdown
Contributor Author

Addressed comments.

@adamfweidman

Copy link
Copy Markdown
Collaborator

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread packages/a2a-server/src/config/config.test.ts Outdated
Comment thread packages/a2a-server/src/config/config.ts Outdated
Comment thread packages/core/src/tools/ripGrep.ts Outdated
Comment thread packages/core/src/utils/ignoreFileParser.ts Outdated
Comment thread packages/core/src/services/fileDiscoveryService.ts

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread packages/core/src/services/fileDiscoveryService.ts Outdated
Comment thread packages/core/src/tools/ripGrep.ts Outdated
Comment thread packages/cli/src/config/settingsSchema.ts Outdated
Comment thread packages/a2a-server/src/config/config.ts
Comment thread packages/core/src/utils/ignoreFileParser.ts
alisa-alisa and others added 2 commits January 27, 2026 15:11
@alisa-alisa
alisa-alisa added this pull request to the merge queue Jan 28, 2026
Merged via the queue into google-gemini:main with commit adc8e11 Jan 28, 2026
25 checks passed
@alisa-alisa
alisa-alisa deleted the custom-ignore-file branch January 28, 2026 01:32
sidwan02 pushed a commit to sidwan02/gemini-cli-gemma that referenced this pull request Feb 6, 2026
…geminiignore (google-gemini#16487)

Co-authored-by: Adam Weidman <adamfweidman@google.com>
kuishou68 pushed a commit to iOfficeAI/gemini-cli-pro that referenced this pull request Feb 27, 2026
…geminiignore (google-gemini#16487)

Co-authored-by: Adam Weidman <adamfweidman@google.com>
cocosheng-g pushed a commit that referenced this pull request May 6, 2026
…geminiignore (#16487)

Co-authored-by: Adam Weidman <adamfweidman@google.com>
@sripasg sripasg added size/xl An extra large PR and removed size/l A large sized PR labels Jun 2, 2026
software-0ficial pushed a commit to software-0ficial/gemini-cli that referenced this pull request Jul 9, 2026
…geminiignore (google-gemini#16487)

Co-authored-by: Adam Weidman <adamfweidman@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality priority/p3 Backlog - a good idea but not currently a priority. review/involved PRs that may take a lot of work to review size/xl An extra large PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for alternate exclusion file types

4 participants