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

Handle trailing newlines consistently in FilePatcher #67

Merged

Conversation

LawnGnome
Copy link
Contributor

Previously, FilePatcher could not differentiate between files with and without trailing newlines, and always wrote files with trailing newlines. As a result, files without trailing newlines that were otherwise unchanged would be modified.

This commit introduces a new LineIterator that preserves the trailing delimiter, if present, and ensures that files are written with the same newline structure they had when read.

Previously, FilePatcher could not differentiate between files with and
without trailing newlines, and always wrote files with trailing
newlines. As a result, files without trailing newlines that were
otherwise unchanged would be modified.

This commit introduces a new LineIterator that preserves the trailing
delimiter, if present, and ensures that files are written with the same
newline structure they had when read.
@dmerejkowsky
Copy link
Collaborator

Excellent :) Thanks a lot

@dmerejkowsky
Copy link
Collaborator

Also, I should say It's pretty nice to see my little pet project featured in sourcegraph's documentation :)

@dmerejkowsky dmerejkowsky merged commit 4dd1cf9 into your-tools:main Jun 8, 2021
@LawnGnome
Copy link
Contributor Author

Also, I should say It's pretty nice to see my little pet project featured in sourcegraph's documentation :)

We're really grateful to you for writing it! Thanks; we like it a lot. 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants