Skip to content

Preserve CRLF when stripping conflict markers - #2253

Open
oxura wants to merge 1 commit into
git-ai-project:mainfrom
oxura:fix/983-preserve-crlf
Open

Preserve CRLF when stripping conflict markers#2253
oxura wants to merge 1 commit into
git-ai-project:mainfrom
oxura:fix/983-preserve-crlf

Conversation

@oxura

@oxura oxura commented Aug 30, 2026

Copy link
Copy Markdown

Fixes #983.

strip_conflict_markers_keep_ours was rebuilding every retained line with \n, so a CRLF working tree silently shifted the byte offsets before attribution merging.

This walks the content with split_inclusive('\n') instead and copies retained slices directly. That keeps CRLF, LF, mixed endings, and the final-newline state exactly as they appeared on disk. It also avoids the temporary Vec and rejoin.

I added a CRLF regression test that produced LF-only output before this change. The focused virtual-attribution tests now pass (13 tests), formatting is clean, and clippy is clean apart from the existing collapsible_match warnings on current main with Rust 1.95.


Devin Review

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

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.

strip_conflict_markers_keep_ours silently converts CRLF to LF, misaligning Windows attribution offsets

2 participants