Merge request diff: Show diff hunk descriptions (for class/method context)

In a merge request, the usual diff hunk descriptions are replaced with an expandable section that allows us to view more of the file. However, this also seems to get rid of any form of context to be immediately visible.

Taking MR 25747 as example, this is what the merge request tab "Changes" looks like: Diff without context in Merge Request

Without expanding upwards, it is not trivial to say which method is changed in the hunk.

Compare this to the same diff viewed from the history: Diff with context in Commit History

This probably isn't the best example since Ruby code doesn't appear to have proper function detection (and as such only shows the module), but I hope you get the idea. It probably should since the docs for gitattributes does include Ruby as possible language. The first hunk could show def create as context, the second could show def update and the third def destroy (or at least, since this is how I'd implement it: the same string that is shown on the commit diff).

Showing this in the expandable header would save a reviewer at least one click (potentially more if the function header/context block starts further up).

To me personally, it would be acceptable to only show this context initially and not update it when expanding (as it might change during the expansion). If the info is readily available as part of the expansion, I'll gladly take it though.

Assignee Loading
Time tracking Loading