Ability to collapse or minimize diffs in pull requests

Issue #7086 open
Virgilio Favero Neto
created an issue

Hi there,

It would be great if we could collapse the diff of a file when reviewing a pull request. That would allow us to reduce the scrolling area as we go reviewing.

Is this feature already on your roadmap?


Comments (63)

  1. Oliver Shaw

    +1 -- Could see this having a small positive effect on traffic if it were to only display large diffs after requesting them (hide all over 2MB or 1000 lines for example)

  2. Joshua Swanson

    Since it appears this is not going to be done, I've written a quick bookmarklet to do it for me - you may also find it useful, so I'll share it here:

    javascript:(function() {$(".diff-container .heading").find(".aui-buttons:first").append($("<button>").addClass('aui-button').text('Minimize').click(function(e){$(e.target).closest('div.diff-container').find(".diff-content-container").toggle();}));})()

    This adds a little "button" to each diff that lets you easily minimize it

  3. Gerson Goulart

    +1. And in all honestly, even if this is not considered to be the feature with the most aggregated value there is, in four years this could have been implemented, could it not? Team, Bitbucket is awesome but this would be a very welcome refinement.

  4. Tristan Warner-Smith

    There are files across many different platforms that are necessarily in source control but unnecessary to review. I've already seen a request to exclude certain files from PRs get the WONT FIX tag, but the ability to manually collapse a file seems like a no-brainer for those of us with these types of files. We've got a 'Show more lines', please, please add a collapse option that simply brings a thousand line file commit to it's minimum displayable.

    I won't even complain if it's hidden in the ... menu.

  5. Sam Lobel

    Quick PSA: The easiest way to get this set up is add a bookmark to javascript which does this for you. Joshua Swanson's comment works as of me writing this. Right-click on your bookmark bar, select "New Bookmark", name it whatever you want, and then in the "location" field copy this code:

    javascript:(function() {$(".diff-container .heading").find(".aui-buttons:first").append($("<button>").addClass('aui-button').text('Minimize').click(function(e){$(e.target).closest('div.diff-container').find(".diff-content-container").toggle();}));})()

    Then, you can just click that bookmark any time you want minimize buttons to show up.

  6. Abraham Bah

    +1 Remove large files from the diff and display a warning label instead. Something like Content truncated due to large file size. Click here to view the full diff

  7. Ivan Muratov

    +1 And please collapse package-lock.json, yarn.lock and similar huge files by default. Everytime when I review PR, I'm crying while scrolling down these files. Or very often these files stop the rendering other files after.

  8. Pierre-Henri Trivier

    @Ivan Muratov Lots of people on this thread would think "Collapsing well known irrelevant files by default" would be the pragmatic, imperfect and quick solution to the problem. In BB developper's defense (they're developpers, too !), I would not be trivial to decide what's the list of "well known irrelevant" files... (not everyone is doing frontend dev... ;) )

  9. Ivan Muratov

    @Pierre-Henri Trivier What about keeping these well known files as settings in profile? Every user will be available to manage their own preferences. By default this list can be empty. And if I tired of yarn.lock file in my diffs, I can just add this file name into this list in my profile settings and it's done - file will be collapsed by default in every PR or commit diffs only for me.

  10. Pierre-Henri Trivier

    @Ivan Muratov sure, that's the full blown solution. I'm pretty sure it was brought up by a few of the BB's dev during the zillons discussions they had about this topic, before not being able to decide and / or having to work on something else for the last few years (assuming their dev life is not that different from our dev life...)

  11. Yonas Hassen

    The way it currently works in a pull request is if there's one single file diff that's too big to load, it doesn't load ANY of the diffs from the other files (see attached screenshot below). It's a frustrating user experience.

    Ideally, it should auto-collapse individual code diffs that are too large to display, and load all of the other diffs. That way, if a user really wants to inspect a large code diff, they can click a link to "expand." The app can then fetch the diff from the server and have it load to the page.

    I hope this makes sense. Thanks for reading! :)

    Screen Shot 2018-09-23 at 3.57.47 PM.png

  12. Log in to comment