1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +00:00

LibDiff: Handle parsing patches containing timestamps separated by \t

This is still a very naive implementation and there are plenty of other
cases that we should handle (like a quoted path) - but just looking for
a tab handles the common case.
This commit is contained in:
Shannon Booth 2024-03-02 21:49:50 +13:00 committed by Andreas Kling
parent 3e3a200eee
commit 3e61d20b40
2 changed files with 19 additions and 1 deletions

View file

@ -61,7 +61,10 @@ bool Parser::consume_line_number(size_t& number)
ErrorOr<String> Parser::parse_file_line(Optional<size_t> const& strip_count)
{
// FIXME: handle parsing timestamps as well.
auto path = consume_line();
auto line = consume_line();
GenericLexer line_parser(line);
auto path = line_parser.consume_until('\t');
// No strip count given. Default to basename of file.
if (!strip_count.has_value())