Skip to content

Avoid creating diff position when line-code is nil

Igor Drozdov requested to merge id-fix-nil-line-codes-for-diff-positions into master

What does this MR do?

Sometimes line_code can't be calculated for a position (for example, when a position doesn't correspond to the actual diff): https://gitlab.com/gitlab-org/gitlab/-/blob/3cc8cfea64f20ff9ac0c2e8ba89c4b2dc7e09995/lib/gitlab/diff/file.rb#L93

In this case, we'll try to insert null line-code in the database: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/discussions/capture_diff_note_position_service.rb#L28

This merge request fixes this issue

Merge request reports