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

Resolve Issue: Update Patchwork Line Endings #1165

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion patchwork/common/tools/code_edit_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ def __create(self, file_text, abs_path):
if abs_path.exists():
return f"Error: File {abs_path} already exists"
abs_path.parent.mkdir(parents=True, exist_ok=True)
abs_path.write_text(file_text)
# When creating a new file, use newline='' to retain original line endings from file_text
with abs_path.open("w", newline="") as fp:
fp.write(file_text)
return f"File created successfully at: {abs_path}"

def __str_replace(self, new_str, old_str, abs_path):
Expand Down
Loading