When a diff request includes an ignore-whitespace level, the same diff content is returned, but a number of diff chunks are marked as "common" with the understanding that those chunks only contain the kind of whitespace that can be ignored. Thus, actually ignoring these chunks is up to the frontend. In this commit, support is added for editing the preferred whitespace level, and the preferred level is included in diff requests. When a diff is loaded with an ignore-whitespace level, gr-diff-host transforms the marked deltas into shared chunks. In this way, when the transformed diff is passed down into gr-diff, it can be rendered like normal and the unwanted whitespace deltas do not appear. To transform a diff with chunks to be ignored, the strategy is as follows. If a marked delta chunk has revision (a right-side), then it's converted to a shared chunk where both sides are made up of the revision content. (If a marked delta chunk has no revision content, it's merely omitted.) Finally, adjacent shared chunks that result from modifying the marked chunks are merged together so that gr-diff will properly position context-control barriers. Feature: Issue 6198 Change-Id: I1e4cc1075edf34f5ce87ee6bfc2cf415a3b98d94
4.0 KiB
4.0 KiB