Commit graph

6 commits

Author SHA1 Message Date
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Shannon Booth
2b46e6f664 Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2023-07-15 16:21:29 +02:00
Shannon Booth
828d791a4f LibDiff: Add Diff::apply_patch
Given a set of lines from the file we are patching, and a patch itself,
this function will try and locate where in the file to apply that patch,
and write the result of patching that file (if successful) to the output
stream.
2023-07-13 10:29:30 +01:00
Shannon Booth
efb26b1781 LibDiff: Implement ability to parse a patch header
This is a somewhat naive implementation, but it is enough to parse a
simple unified patch header.

After parsing the patch header, the parser will be at the beginning of
the first hunks range, ready for that hunk to be parsed.
2023-07-13 10:29:30 +01:00
Shannon Booth
ef45221c21 LibDiff: Make parsing of unified hunks more robust
Parsing of the unified hunks now verifies that the expected number of
lines given by the unified location at the beginning of that hunk are
actually in that hunk. Furthermore, we no longer crash when given a
bogus unified range.

As a further benefit, this begins the scaffolding for a patch parser
which should assist us in parsing full patches - even when we are not
aware of the format that a patch has been written in.
2023-07-13 10:29:30 +01:00
Shannon Booth
696c92882a LibDiff: Add a forwarding header 2023-07-06 13:22:37 +02:00