Closed slack-coder closed 8 months ago
You can see here that trailing newlines are ignored and aren't included as a diff::Line
.
Its more about diff::Line
itself, whether diff::Line
s with/without trailing '\n' are legal and expected.
println("{}", line.from_utf8().unwrap());
print("{}", line.from_utf8().unwrap());
or
let line = Line::from("hello".to_string());
let line = Line::from("hello\n".to_string());
It has no opinion on newlines https://github.com/radicle-dev/radicle-git/blob/main/radicle-surf/src/diff.rs#L452-L480, so they're legal afaict.
Good to know, its a potential gotcha for implementers as it can provide lines ending with or without '\n'.
And why would that be a gotcha?
And why would that be a gotcha?
"its a potential gotcha for implementers as it can provide lines ending with or without '\n'." and its not documented for people handling the type. Has this changed for the issue to be marked as completed?
What is the relationship between
diff::Line
and trailing newlines?It is hard to tell from the documentation whether they are included, enforced, or optional, when it should communicate what consumers can expect about
diff::Line
s content.Edit: update context