MCPcopy Create free account
hub / github.com/desktop/desktop / diffFromRawDiffOutput

Function diffFromRawDiffOutput

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

* Utility function used by get(Commit|WorkingDirectory)Diff. * * Parses the output from a diff-like command that uses `--path-with-raw`

(output: Buffer)

Source from the content-addressed store, hash-verified

753 * Parses the output from a diff-like command that uses `--path-with-raw`
754 */
755function diffFromRawDiffOutput(output: Buffer): IRawDiff {
756 // for now we just assume the diff is UTF-8, but given we have the raw buffer
757 // we can try and convert this into other encodings in the future
758 const result = output.toString('utf-8')
759
760 const pieces = result.split('\0')
761 const parser = new DiffParser()
762 return parser.parse(forceUnwrap(`Invalid diff output`, pieces.at(-1)))
763}
764
765async function buildSubmoduleDiff(
766 buffer: Buffer,

Callers 2

getResolutionDiffFunction · 0.85
buildDiffFunction · 0.85

Calls 3

parseMethod · 0.95
forceUnwrapFunction · 0.90
toStringMethod · 0.45

Tested by

no test coverage detected