mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-03-23 05:46:06 +00:00
LibDiff: Add Diff::write_unified_header
This is used to write a unified patch header.
This commit is contained in:
committed by
Andrew Kaster
parent
a4e50deeea
commit
f528aedc85
@@ -24,6 +24,14 @@ DeprecatedString generate_only_additions(StringView text)
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
ErrorOr<void> 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<void> write_unified(Hunk const& hunk, Stream& stream, ColorOutput color_output)
|
||||
{
|
||||
TRY(stream.write_formatted("{}\n", hunk.location));
|
||||
|
||||
@@ -21,6 +21,8 @@ enum class ColorOutput {
|
||||
};
|
||||
|
||||
ErrorOr<void> write_unified(Hunk const& hunk, Stream& stream, ColorOutput color_output = ColorOutput::No);
|
||||
ErrorOr<void> write_unified_header(StringView old_path, StringView new_path, Stream& stream);
|
||||
|
||||
ErrorOr<void> write_normal(Hunk const& hunk, Stream& stream, ColorOutput color_output = ColorOutput::No);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user