Skip to content

Make apply_patch preserve line endings unconditionally - #51203

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/96d0b0e5350faa3fc7a45d63627a132657b44523
Oct 5, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/96d0b0e5350faa3fc7a45d63627a132657b44523

Conversation

@copyberry

@copyberry copyberry Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Make apply_patch preserve line endings unconditionally

Why

Updating a CRLF file with apply_patch previously normalized its line endings to LF unless preservation was explicitly enabled. Preserve the file's existing line endings without requiring an opt-in.

What changed

  • Use line-ending-preserving updates for both tool calls and standalone apply_patch invocations, removing the legacy normalization mode.
  • Mark apply_patch_preserve_line_endings as removed.
  • Always set CODEX_APPLY_PATCH_PRESERVE_LINE_ENDINGS=1 in child environments for compatibility with older patch executables, overriding stale values.

Testing

Update CLI, tool-call, shell-heredoc, and app-server tests to check CRLF preservation by default. Keep coverage for overriding stale compatibility environment values.

## Why

Updating a CRLF file with `apply_patch` previously normalized its line endings to LF unless preservation was explicitly enabled. Preserve the file's existing line endings without requiring an opt-in.

## What changed

- Use line-ending-preserving updates for both tool calls and standalone `apply_patch` invocations, removing the legacy normalization mode.
- Mark `apply_patch_preserve_line_endings` as removed.
- Always set `CODEX_APPLY_PATCH_PRESERVE_LINE_ENDINGS=1` in child environments for compatibility with older patch executables, overriding stale values.

## Testing

Update CLI, tool-call, shell-heredoc, and app-server tests to check CRLF preservation by default. Keep coverage for overriding stale compatibility environment values.

GitOrigin-RevId: 96d0b0e5350faa3fc7a45d63627a132657b44523
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/96d0b0e5350faa3fc7a45d63627a132657b44523 branch from 86db744 to 685270a Compare October 5, 2026 23:52
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-05T23:53:05.676389Z 86db744 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@copyberry
copyberry Bot merged commit 685270a into main Oct 5, 2026
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/96d0b0e5350faa3fc7a45d63627a132657b44523 branch October 5, 2026 23:52
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 5, 2026
@alfred557557
alfred557557 deployed to issue-triage October 6, 2026 00:01 — with GitHub Actions Active
@alfred557557
alfred557557 deployed to issue-triage October 6, 2026 00:01 — with GitHub Actions Active
@alfred557557
alfred557557 deployed to issue-triage October 6, 2026 00:01 — with GitHub Actions Active
@alfred557557
alfred557557 deployed to issue-triage October 6, 2026 00:02 — with GitHub Actions Active

This branch was successfully deployed

1 active deployment
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants