Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep multiple whitelines and same comments from the gitignore file #4659

Conversation

Jenson3210
Copy link
Contributor

As I originally used a Set, the empty lines and comments with same text where being filtered to a single occurence (the last one).

By changing the implementation to a LinkedList into which we add conditionally entries, we can save a new List instantiation + keep comments and whitelines non-distinct, maintaining dinstinction of the gitgnore lines (same line later in file makes sure we only keep that one)

See the changed test for the bug I was facing while first time running on a gitignore file with multiple empty lines.

@timtebeek timtebeek merged commit fda000b into openrewrite:main Nov 11, 2024
2 checks passed
@timtebeek timtebeek added the enhancement New feature or request label Nov 11, 2024
@Jenson3210 Jenson3210 deleted the keep_duplicate_whiltelines_and_comments_gitignore branch November 11, 2024 23:32
MBoegers pushed a commit to MBoegers/rewrite that referenced this pull request Dec 18, 2024
…penrewrite#4659)

* Keep multiple whitelines and same comments from the gitignore file

* Keep multiple whitelines and same comments from the gitignore file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants