Skip to content

fix(core): handle line endings in ignore file parsing#23895

Merged
cynthialong0-0 merged 2 commits intogoogle-gemini:mainfrom
xoma-zver:fix/ignore-parsers-crlf
Apr 22, 2026
Merged

fix(core): handle line endings in ignore file parsing#23895
cynthialong0-0 merged 2 commits intogoogle-gemini:mainfrom
xoma-zver:fix/ignore-parsers-crlf

Conversation

@xoma-zver
Copy link
Copy Markdown
Contributor

Summary

Fixed incorrect handling of different line endings (CRLF, LF, CR) in ignore file parsers. Changed split('\n') to split(/\r\n|\n|\r/) in both GitIgnoreParser and IgnoreFileParser to match Git's behavior and ensure cross-platform compatibility (Windows CRLF, Unix LF, legacy Mac CR).

Details

Related Issues

Fixes #23891

How to Validate

Create a test project and initialize Git. Create a .gitignore file with CRLF line endings. Run the Gemini CLI file reading command.
Expected result: Files from .gitignore should be ignored (skipped).

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

@xoma-zver xoma-zver requested a review from a team as a code owner March 26, 2026 14:22
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 resolves an issue with incorrect handling of various line endings in ignore file parsers. By updating the splitting mechanism, it ensures that ignore patterns are consistently applied across different operating systems, improving the reliability and cross-platform compatibility of file exclusion logic.

Highlights

  • Line Ending Handling: Updated GitIgnoreParser and IgnoreFileParser to correctly parse ignore files with different line endings (CRLF, LF, CR) by changing split('\n') to split(/\r\n|\n|\r/) to match Git's behavior and ensure cross-platform compatibility.
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.

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.

Copy link
Copy Markdown
Contributor

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

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 updates the GitIgnoreParser and IgnoreFileParser to use a more robust line splitting mechanism. The change from split('\n') to split(/\r\n|\n|\r/) ensures that files with different line ending conventions (CRLF, LF, or CR) are parsed correctly. There is no feedback to provide.

@gemini-cli gemini-cli Bot added the area/core Issues related to User Interface, OS Support, Core Functionality label Mar 26, 2026
@gemini-cli
Copy link
Copy Markdown
Contributor

gemini-cli Bot commented Apr 10, 2026

Hi there! Thank you for your interest in contributing to Gemini CLI.

To ensure we maintain high code quality and focus on our prioritized roadmap, we have updated our contribution policy (see Discussion #17383).

We only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'. All other community pull requests are subject to closure after 14 days if they do not align with our current focus areas. For this reason, we strongly recommend that contributors only submit pull requests against issues explicitly labeled as 'help-wanted'.

This pull request is being closed as it has been open for 14 days without a 'help wanted' designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding and for being part of our community!

@gemini-cli gemini-cli Bot closed this Apr 10, 2026
@xoma-zver
Copy link
Copy Markdown
Contributor Author

This makes it harder to contribute to simple issues that have been sitting in the backlog for a long time. However, I understand that this approach may be fair for optimizing time and resource allocation.

@cynthialong0-0
Copy link
Copy Markdown
Contributor

/gemini review

Copy link
Copy Markdown
Contributor

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

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 updates the GitIgnoreParser and IgnoreFileParser in the core package to handle various line ending formats (LF, CRLF, and CR) when splitting file content into patterns. This ensures better cross-platform compatibility for ignore file parsing. I have no feedback to provide.

@cynthialong0-0 cynthialong0-0 added this pull request to the merge queue Apr 22, 2026
@gemini-cli gemini-cli Bot added priority/p3 Backlog - a good idea but not currently a priority. help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! labels Apr 22, 2026
Merged via the queue into google-gemini:main with commit 1c43dee Apr 22, 2026
27 checks passed
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 help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! priority/p3 Backlog - a good idea but not currently a priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect handling of line endings in ignore file parsers

2 participants