Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

🐛 Windows line endings break parsing of .gitignore #4556

Closed
m1212e opened this issue Jun 9, 2023 · 2 comments
Closed

🐛 Windows line endings break parsing of .gitignore #4556

m1212e opened this issue Jun 9, 2023 · 2 comments
Labels
A-Project Area: project configuration and loading S-Bug: confirmed Status: report has been confirmed as a valid bug

Comments

@m1212e
Copy link
Contributor

m1212e commented Jun 9, 2023

On windows the CRLF line endings break parsing of the .gitignore files. This doesn't throw any error since a .git folder and an ignore file exist, its just that its contents arent parsed correctly.

I think this might be the relevant code snippet (rome/tools/crates/rome_cli/src/vcs.rs):

            if let Some((buffer, _)) = buffer {
                return Ok(buffer
                    .split('\n') // this should be platform agnotic or throw an error when CRLF is detected
                    // remove empty lines
                    .filter(|line| !line.is_empty())
                    .filter_map(|item| {
                        let line = item.to_string();
                        // remove comments
                        if !line.starts_with('#') {
                            Some(line)
                        } else {
                            None
                        }
                    })
                    .collect::<Vec<String>>());
            }

If you want I can create a pull request?

@m1212e m1212e added the S-To triage Status: user report of a possible bug that needs to be triaged label Jun 9, 2023
@ematipico ematipico added S-Bug: confirmed Status: report has been confirmed as a valid bug A-Project Area: project configuration and loading and removed S-To triage Status: user report of a possible bug that needs to be triaged labels Jun 9, 2023
@ematipico
Copy link
Contributor

Yeah, it would make sense to handle CRLF too when parsing the gitignore file. A PR would be great! Yes, that's the code 😁

@m1212e
Copy link
Contributor Author

m1212e commented Jun 9, 2023

There you go: #4558

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Project Area: project configuration and loading S-Bug: confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

No branches or pull requests

2 participants