-
- Downloads
Detect MarkerRanges for word-diff mode
Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/16950 Follow-up for https://gitlab.com/gitlab-org/gitlab/-/merge_requests/55105 Extend to Gitlab::WordDiff::ChunkCollection class to generate `marker_ranges` based on chunks received from `git diff --word-diff=porcelain` output. Each chunk can be an unchanged string (starts with ` `), new string (starts with `+`) or removed string (starts with `-`). While parsing we collect chunks until we receive a newline delimiter. Then we are combining them together to generate Gitlab::Diff::Line object and assign MarkerRanges for changed parts of the diff line.
Showing
- lib/gitlab/marker_range.rb 6 additions, 0 deletionslib/gitlab/marker_range.rb
- lib/gitlab/word_diff/chunk_collection.rb 21 additions, 0 deletionslib/gitlab/word_diff/chunk_collection.rb
- lib/gitlab/word_diff/parser.rb 1 addition, 1 deletionlib/gitlab/word_diff/parser.rb
- spec/lib/gitlab/diff/char_diff_spec.rb 3 additions, 3 deletionsspec/lib/gitlab/diff/char_diff_spec.rb
- spec/lib/gitlab/marker_range_spec.rb 30 additions, 3 deletionsspec/lib/gitlab/marker_range_spec.rb
- spec/lib/gitlab/word_diff/chunk_collection_spec.rb 23 additions, 0 deletionsspec/lib/gitlab/word_diff/chunk_collection_spec.rb
- spec/lib/gitlab/word_diff/parser_spec.rb 32 additions, 8 deletionsspec/lib/gitlab/word_diff/parser_spec.rb
Please register or sign in to comment