POC: Avoid parsing blobs to highlight diffs [RUN ALL RSPEC] [RUN AS-IF-FOSS]
What does this MR do?
Feature flag: blobless_diff_highlighting
Related issue: https://gitlab.com/gitlab-org/gitlab/-/issues/300228
Currently, we load and highlight old and new versions of the blob of a diff. Then diff lines are mapped to the highlighted content of the blob. It can be quite expensive when a small part of a huge file is changed.
Let's instead extract blob content from diff lines and highlight them.
For example, when we have
unchanged line
+added line
-removed line
...
another unchanged line
+another added line
We parse it into old content chunks: [[removed line], []]
And new content chunks: [[unchanged line, added line], [another unchanged line, another added line]]
Then we concatenate the lines:
old file chunk:
removed line
new file chunk:
unchanged line
added linee
new file second chunk:
another unchanged line
another added line
highlight each chunk separately and map the diff lines to the content of the chunks.
Edited by Igor Drozdov