diff --git a/Userland/Libraries/LibDiff/Format.cpp b/Userland/Libraries/LibDiff/Format.cpp index 6417f6f9a5..f3c4c1c7ce 100644 --- a/Userland/Libraries/LibDiff/Format.cpp +++ b/Userland/Libraries/LibDiff/Format.cpp @@ -210,4 +210,12 @@ ErrorOr write_context(Hunk const& hunk, Stream& stream, ColorOutput color_ return write_hunk_as_context(split_lines.old_lines, split_lines.new_lines, hunk.location, stream, color_output); } +ErrorOr write_context_header(StringView old_path, StringView new_path, Stream& stream) +{ + TRY(stream.write_formatted("*** {}\n", old_path)); + TRY(stream.write_formatted("--- {}\n", new_path)); + + return stream.write_formatted("***************\n"); +} + } diff --git a/Userland/Libraries/LibDiff/Format.h b/Userland/Libraries/LibDiff/Format.h index a80d2fbb26..f6a83627a2 100644 --- a/Userland/Libraries/LibDiff/Format.h +++ b/Userland/Libraries/LibDiff/Format.h @@ -26,4 +26,5 @@ ErrorOr write_unified_header(StringView old_path, StringView new_path, Str ErrorOr write_normal(Hunk const& hunk, Stream& stream, ColorOutput color_output = ColorOutput::No); ErrorOr write_context(Hunk const& hunk, Stream& stream, ColorOutput color_output = ColorOutput::No); +ErrorOr write_context_header(StringView old_path, StringView new_path, Stream& stream); }