Collapsible diffs in diff view
Description including problem, use cases, benefits, and/or goals
When viewing large diffs, things that are less important take away from the focus of the user.
In addition, many people like to be able to hide things / diffs they've reviewed or are done with. For careful review of large diffs this can make quite a difference.
Lastly, large diffs can be very slow to load. Hiding diffs would help towards improving this.
To hide diffs, we can simply use collapseable diffs.
We add the ability to collapse and unfold a diff and provide sensible defaults for their behavior.
For normal diffs we should:
- collapse deleted files
- show all other diffs
- allow expanding / collapsing of any of the diffs
In addition, for large diffs we should:
- collapse all large diffs, in addition to deleted files
- load the large diffs only upon expanding
There should be a button to expand all diffs that changes into
Collapse all, when all diffs are expanded.
The mockup is just a suggestion. Because I think you should be able to re-collapse something after expanding it, @jschatz1's last proposal doesn't suffice. Alternatively, clicking on the header of the diff could do this for you or a button elsewhere.
@dzaporozhets suggest to just be able to click on the file name. Good idea!
Links / references
I got in this situation when reviewing a merge request which deleted a lot of files, which was a directory. The diff view consisted of 100 files showing all deleted lines. I would like to see the ability to collapse the file-holder to I can easily scan the diffs in an overview.
This would've allowed me to see a folder was deleted and the files where contained in this directory.