* 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)
| 730 | * @param error A buffer of binary text from a spawned process |
| 731 | */ |
| 732 | function 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. |
no test coverage detected