Skip to content

Don't add a newline to a file which doesn't end with a newline - #16

Merged
greg-at-moderne merged 1 commit into
mainfrom
greg-jgit-applytext-eof-newline
Aug 26, 2026
Merged

Don't add a newline to a file which doesn't end with a newline#16
greg-at-moderne merged 1 commit into
mainfrom
greg-jgit-applytext-eof-newline

Conversation

@greg-at-moderne

Copy link
Copy Markdown
Contributor

What: Changing the ApplyCommand not to alter the ending of the file (if not asked for). Specifically whether the file ends with a newline character or not.

Why: As observed in production use, some OpenRewrite recipes resulted in unwarranted changes on top of other changes. When a file was long enough, had no trailing newline character, then some recipes would perform the requested changes and add a newline at the end.

@timtebeek timtebeek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@github-project-automation github-project-automation Bot moved this from In Progress to Ready to Review in OpenRewrite Aug 26, 2026
@greg-at-moderne
greg-at-moderne merged commit 21300c6 into main Aug 26, 2026
1 check passed
@greg-at-moderne
greg-at-moderne deleted the greg-jgit-applytext-eof-newline branch August 26, 2026 13:12
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants