fix(core): normalize CRLF patch lines (#38038)
This commit is contained in:
parent
96dc560833
commit
e770415fd5
2 changed files with 25 additions and 1 deletions
|
|
@ -44,7 +44,9 @@ export interface FileUpdate {
|
|||
}
|
||||
|
||||
export function parse(patchText: string): Result.Result<ReadonlyArray<Hunk>, ParseError> {
|
||||
const lines = stripHeredoc(patchText.trim()).split("\n")
|
||||
const lines = stripHeredoc(patchText.trim())
|
||||
.split("\n")
|
||||
.map((line) => (line.endsWith("\r") ? line.slice(0, -1) : line))
|
||||
const begin = lines.findIndex((line) => line.trim() === "*** Begin Patch")
|
||||
const end = lines.findIndex((line) => line.trim() === "*** End Patch")
|
||||
if (begin === -1) return Result.fail(new BoundaryError({ boundary: "first" }))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue