Repository navigation
fix(git): preserve non-LF characters in structured diffs - #253
Merged
Zongwei9888 merged 1 commit intoOct 12, 2026
Merged
Conversation
KennyMcSimpson
marked this pull request as ready for review
October 5, 2026 11:20
Collaborator
|
Merged in c6e3a5b. Thank you for the fix and the detailed reproduction, @KennyMcSimpson. What I checked against main before merging:
One visible difference, for the record: lines of CRLF files now keep their trailing The red Windows job you may have seen was unrelated (the runner image's preinstalled pipx conflicted with our CI lock); it is fixed on main in f6ab0e7. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Structured Git diffs split file content at characters that Git does not treat as line endings. For example,
alpha\u2028beta\nnext\nis two lines to Git, but the untracked-file preview reports three additions. In a tracked patch, the text after U+2028 becomes a metadata row and subsequent line numbers are wrong.Use LF boundaries for both patch records and untracked content. This keeps Unicode separators, form feeds, vertical tabs and carriage returns in the original line, while handling empty files and final newlines correctly.
Related Issues
No linked issue; reproduced in a temporary Git repository through
application.git.diff.Changes Made
--numstatas a reference for tracked changes.Checklist
Additional Notes
python -m pytest tests/application/test_p4_code_workbench.py -q— 29 passed; 15 new cases fail before the fix.git diff --checkpasses.Operation not permitted).