MCPcopy Index your code
hub / github.com/desktop/desktop / parseLineEndingsWarning

Function parseLineEndingsWarning

app/src/lib/git/diff.ts:732–748  ·  view source on GitHub ↗

* Utility function for inspecting the stderr output for the line endings * warning that Git may report. * * @param error A buffer of binary text from a spawned process

(error: Buffer)

Source from the content-addressed store, hash-verified

730 * @param error A buffer of binary text from a spawned process
731 */
732function parseLineEndingsWarning(error: Buffer): LineEndingsChange | undefined {
733 if (error.length === 0) {
734 return undefined
735 }
736
737 const errorText = error.toString('utf-8')
738 const match = lineEndingsChangeRegex.exec(errorText)
739 if (match) {
740 const from = parseLineEndingText(match[1])
741 const to = parseLineEndingText(match[2])
742 if (from && to) {
743 return { from, to }
744 }
745 }
746
747 return undefined
748}
749
750/**
751 * Utility function used by get(Commit|WorkingDirectory)Diff.

Callers 1

getWorkingDirectoryDiffFunction · 0.85

Calls 2

parseLineEndingTextFunction · 0.90
toStringMethod · 0.45

Tested by

no test coverage detected