#87 diff: added lines starting +++/--- are misclassified as file headers

closeduiopened
details
updated
id
3aeb0d21-a690-4369-82a2-cd7e75037ec7

What

Diff lines are classified purely by prefix:

src/layout.rs:109-127: line.starts_with("+++") / starts_with("---") before the add/remove branches.

Reproduced

Append four lines to a tracked file: +++ not a header, --- not a header, @@ not a hunk, prefix+++line. The commit page reports +3 (4 actual added) and the ++++ not a header row is styled as a file header; subsequent new-side line numbers are off by one.

Impact

Wrong diffstat and line numbers; a reviewer can be misled about what changed (content can hide from the count).

Fix

Use diff position: +++/--- are headers only before the first @@ hunk (and +++ after ---); otherwise classify by the leading marker. Or require the a//b/ prefix for headers. Add a fixture test for content that starts with +++/---/@@.

Comments (0)

No comments yet.

all issues