diff --git a/Userland/Libraries/LibDiff/Format.cpp b/Userland/Libraries/LibDiff/Format.cpp index 996b56079b..7951a92d11 100644 --- a/Userland/Libraries/LibDiff/Format.cpp +++ b/Userland/Libraries/LibDiff/Format.cpp @@ -24,6 +24,14 @@ DeprecatedString generate_only_additions(StringView text) return builder.to_deprecated_string(); } +ErrorOr write_unified_header(StringView old_path, StringView new_path, Stream& stream) +{ + TRY(stream.write_formatted("--- {}\n", old_path)); + TRY(stream.write_formatted("+++ {}\n", new_path)); + + return {}; +} + ErrorOr write_unified(Hunk const& hunk, Stream& stream, ColorOutput color_output) { TRY(stream.write_formatted("{}\n", hunk.location)); diff --git a/Userland/Libraries/LibDiff/Format.h b/Userland/Libraries/LibDiff/Format.h index 0ae15ed258..303c804c24 100644 --- a/Userland/Libraries/LibDiff/Format.h +++ b/Userland/Libraries/LibDiff/Format.h @@ -21,6 +21,8 @@ enum class ColorOutput { }; ErrorOr write_unified(Hunk const& hunk, Stream& stream, ColorOutput color_output = ColorOutput::No); +ErrorOr write_unified_header(StringView old_path, StringView new_path, Stream& stream); + ErrorOr write_normal(Hunk const& hunk, Stream& stream, ColorOutput color_output = ColorOutput::No); }