Files
orca/src
d426e35be3 fix(gitlab): count diff lines whose content begins with -- or ++ (#12133)
* fix(gitlab): count diff lines whose content begins with -- or ++

countDiffLines skipped every line starting with ---/+++ as a file header,
but a removed line whose original text began with -- (SQL/Lua/Haskell
`-- comment`) becomes a diff line `---<content>`, colliding with the
`--- a/file` header — so its deletion was silently dropped from the
+N/-N shown in the GitLab MR dialog. Same collision for an added line
whose content began with ++ (+++ flag).

Track hunk state: ---/+++ are file headers only before the first @@;
inside a hunk every +/- is content, matching the unified-diff rule git
itself uses to disambiguate headers from content.

Co-authored-by: Claude <noreply@anthropic.com>

* fix(gitlab): validate countDiffLines with actual diff format

GitLab's /diffs endpoint returns json_safe_diff starting at @@ without
file headers. Add comprehensive test coverage validating the collision
fix correctly handles this format: content lines beginning with -- or ++
are counted as additions/deletions.

Tests cover binary files, empty diffs, no-newline markers, and content
beginning with @@ or C-style ++. Clarify function contract: requires
hunk headers to distinguish headers from content lines.

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
2026-08-02 17:12:37 -07:00
..