fix(isUnix): exempt final line before no-newline marker from CR check - #702
fix(isUnix): exempt final line before no-newline marker from CR check#702ExplodingCabbage with Copilot wants to merge 4 commits into
Conversation
Co-authored-by: ExplodingCabbage <2358339+ExplodingCabbage@users.noreply.github.com>
…n CRLF source; update release notes Co-authored-by: ExplodingCabbage <2358339+ExplodingCabbage@users.noreply.github.com>
Done in 9b17735:
|
ExplodingCabbage
commented
Aug 18, 2026
This PR was opened targeting |
ExplodingCabbage
commented
Aug 18, 2026
Interesting crapness from @copilot above; I guess the GitHub tooling for fix PRs can't handle when the base PR's branch is on another fork (hence this being branched off master), and also that the AI doesn't understand its own toolchain well enough to even know or explain this (hence the nonsensical explanation above; obviously a PR fixing another PR should target that PR's head branch, not its base branch, and normally does). Anyway, I've manually merged the changes into #701 and will close this now. |
isUnixincorrectly returnedfalsefor patches where the final content line ends with\rbecause the file has no trailing newline — e.g. a Unix patch replacingline2\nwith a finalline3\rfollowed by\\ No newline at end of file. This causedapplyPatchto skipunixToWinconversion when applying such a patch to a CRLF source, making deletion matching fail and returningfalse.Changes
src/patch/line-endings.ts—isUnixnow mirrors the exemption already inisWin: a line ending with\ris not counted as a CR-terminated line if it is immediately followed by the no-newline marker.test/patch/line-endings.js— Adds a regression test assertingisUnixreturnstruefor a patch whose final content line ends with\rand is followed by the no-newline marker.