Issue #6024 open

Ability to ignore whitespace changes in the side-by-side diff viewer (BB-7282)

Shaun Ek avatarShaun Ek created an issue

I would love the ability to have an "Ignore whitespace" toggle on the popup side-by-side diff viewer.

Nowadays, we utilize the side-by-side diff to more clearly see what changed in a changeset or pull request. We love it. Great stuff. But sometimes we get a contribution from a boneheaded developer who decided to use his IDE's "format" functionality to format the code according to his personal preference, and this can make it very difficult for us to spot the actual changes in the file, as opposed to just whitespace changes.

Yes, the side-by-side diff viewer popup thingy does enable us to better see the whitespace changes than the standard diff output, but adding an Ignore Whitespace toggle would be absolutely wonderful.

Comments (157)

  1. Jon Mooring
    • changed status to open

    Thanks for the suggestion, Shaun. While we have no plans to implement this in the near-term, I have opened a ticket in our internal tracker and will be leaving this issue open for additional feedback from the community.


  2. Matthew Nichols

    As someone who does code reviews on the code from a distributed team I agree this would be huge. Try as I might it is tough to enforce exact code formatting standards across such teams and so seeing the real change can be difficult.

  3. Matt Augustine

    I would like to see the option to ignore space changes in the diff viewer as well. It allows us to focus on the real changes, and not be distracted by extra +/- lines. Thanks!

  4. YNAB

    +1 Found this because I was searching for this exact feature. I have a branch where I made a lot of whitespace changes I don't care about, so it's reporting many more changes than I actually made in the file-by-file summaries.

  5. Shealen Clare

    This would be huge. I review a lot of Javascript PRs and there are cases where indentation makes the diffs almost meaningless to humans. That's rough.

  6. Ricky Cormier

    Due to lack of progress (interest?) on this (and other) issue(s) I have now migrated back to Github. I originally migrated to Bitbucket thinking that the might of Atlassian would make it a great product but the truth is it's really not. I cannot believe this small but quite significant issue has been ignored for so long!

    So long and thanks for all the fish!

  7. Alain Dumesny

    +1 the standard diff becomes useless with white spacing changes (please make it ignored space by default) but I use side by side a lot these days as it'as also a lot better seeing other real changes IMO. Having spacing ignored there would help (easier to skip those than regular diff view but still annoying). Both views should have it by default IMO.

  8. Mariano Navas

    +1. Due to best coding practices we have configured our IDEs to replace tabs with spaces, and that produces diffs in every line of every file. The only way to see where changes in code are is ignoring whitespace feature.

  9. Michael Bean

    I moved my vote to here (removed it from the duplicate). I wonder if marking as duplicate linked their votes. I'll put my vote back on the duplicate just in case.

  10. Chris Tsongas

    The lack of this feature compromises the quality of the code I produce using BitBucket...often I will skip fixing jacked-up indentation left by other developers because I don't want to confuse people by having it look like many lines of code were changed.

  11. Marcus Bertrand

    We do not monitor the issue tracker for +1's. Please use the vote feature on tickets to let us know you want a specific feature to be implemented. All +1's are ignored.

  12. Howard Jess

    To Marcus Bertrand

    With regard to soliciting votes in preference to comments: I understand your need to follow policy ....

    ... but geez -- there are over 50 +1s, which may or may not overlap with the 84 actual votes. It'd be so great, and much more useful, for commenters and watchers, to get some feedback about what your intentions are for this issue. It's been over 10 months since Jon Mooring said

    While we have no plans to implement this in the near-term,
    I have opened a ticket in our internal tracker and will be leaving
    this issue open for additional feedback from the community

    Well, it's still open, there's been plenty of community feedback, and the only Atlassian response, since then, is your statement that you ignore customer comments; this is neither helpful nor informative.

  13. Matthew Schettler

    the funny thing this is literally a few hours for someone to implement, and without it it leaves bitbucket complete fucked when it comes to peer reviewing code. I dont want to look at 800+ whitespace changes to find the one change that someone made.

    back to github,

  14. Michael Bean

    Although useless in the count, it is not entirely useless. For example, I get emails that show that people are using +1. If I created this issue, I would get that email and know that someone probably voted on the issue. This might inspire me to update it, etc.

    A +1 can serve the same purpose as "I would write text here, but the description says it all."

  15. Lorenzo Stoakes

    I only just noticed the voting button (it's quite hidden on the panel up there), and attempted repeatedly to delete my +1 comment, however it simply fails. However these are both unrelated issues, but still :)

  16. Michael Bean

    Here's a post-hoc way to do it:

    $('body').html($('body').html().replace(/<del>(\s*)<\/del>/, '$1'));

    $('body').html($('body').html().replace(/<ins>(\s*)<\/ins>/, '$1'));

    //Remove additions/deletions that are marked but don't need to be:

    additionDeletions = $('.addition, .deletion');

    //TODO implement foo()

    foo();// I haven't done this part yet. I got 80% of the way at least...

  17. Howard Jess

    FGS! Why is this even necessary? (And it's so ironic: posting what should be an unnecessary solution to a Bitbucket issue on Github :))

    Can an Atlassian/Bitbucket representative comment here on what the plans are, or if there even are any plans, for this issue? PLEASE!?!? This issue is now officially over 10 months old, with no feedback in the face of over 100 votes, and (I'm not bothering to count, since we've been informed that they're ignored) "several" +1's.

    (You, Atlassian, are aware of git diff -w, I hope; perhaps you don't really use that command to generate the HTML for these pages, which might help explain why this seems to be so difficult to implement??)

  18. Mike Todd

    Seems like this should be pretty basic. As Howard says above, even git itself offers this with the -w option. This should be trivial to add.

  19. Ben Peachey

    Michael Bean I was thinking about something along the same lines, but in the current implementation that won't work as the diff view often includes the text as well as the whitespace.

    I think they'll have to fix this in the server-side code, not in the client. Unless the entire diff is run in the client.

    I think Mike Todd is correct, this should be pretty trivial to implement...

  20. Michael Bean

    +potherca, that is why I was only eliminating on whitespace by using (\s*) in the regex.

    Correct me if I'm wrong, the part that is missing in the gist is the more complex DOM-traversing required to determine whether anything with the class .deletion or .addition actually contained anything but whitespace changes.

    Yes, it's add-hoc, but I think it would work. I just haven't gotten around to traversing yet. jQuery would probably make it simpler, though.

  21. Eric Wilson

    Jon Mooring - why is there resistance to implement this requested feature? Not having it turns PRs into a chore when simple edits have been made.

    As mentioned by Brenton Simpson it would be incredibly valuable having the option to add ?w=0 (or something similar) to ignore whitespace in diffs.

    Is this still not on the roadmap? Please advise.

  22. Jon Anderson

    I'm sure I've seen it mentioned somewhere before, but it would be nice if (nonduplicated) votes on the duplicate issues were automatically added to this one :)

    Atlassian can you comment on whether this (the hiding whitespace) is on the roadmap? It would be very reassuring and make it easier knowing it was temporary. :) thanks btw for BB. It's a great service overall

  23. Martin Gisser

    A diff viewer that can't ignore whitespace is not functional. Period.
    Any plans to implement a functional diff viewer? (It need not be as good as TkDiff of +10y back.)

  24. Brian Amberg

    +1 again, and for everyone new here, remember to add your vote not only as a +1 which will be ignored, but also to use the vote button in the upper right hand corner.

  25. Matthew Hillier

    Could do with it ignoring line-ending changes too... going through the transition of setting up the eol plugin for a bunch of developers on different environments is painful...!

  26. Erik Alapää

    Ideally, the web gui should support at least these three switches (from manpage of git-diff):

    --ignore-space-at-eol -b, --ignore-space-change -w, --ignore-all-space

    Not having ignore whitespace functionality is a stopper bug. May necessitate a move to e.g. github.

  27. Andrew Dunai

    Holy crap, it's been here for over more than year! I still keep receiving tons of notifications about this discussion. Will that even be done? Is that so hard to implement? What the hell? Playing Microsoft? The priority should be CRITICAL, damnit!

  28. Michael Bean

    If anyone wants to help out, I have a github gist that just needs a bit of code in the recursive part of a function. See comment #comment-6996362. If it ends up working, maybe we all could inject it into our browsers and test it out for a while. If it works, we can submit it as code they could use.

  29. Ralph Callaway

    Jon Mooring any chance we can get an update on where this stands with Atlassian's internal priorities? This is now the most highly voted open issue by a wide margin and would dramatically increase the quality of bitbucket and it's user's ability to do code reviews.

  30. Martin Gisser

    Well, it seems nowadays to be acceptable software management practise to forget about the trivial yet helpful functionalities. Eclipse can't fold lines and can't search over the opened files ("But we have indeed some pretty complex search functionality"). Google's Ersatz Excel can't insert new single cells (shifting the neighbors). And I won't look for how the basic Java graphics math has been doing in the last years. Nor will I complain about c21st text editors, File managers, modern Linux "Desktops" (n peepholes while Windows has 1. Great. c20st Fvwm had a desk). Oh, is there any decent Windows Diff tool out there?

    BTW, I'd also like to get a link to JIRA comments without needing to inspect the HTML. What any good Forum can serve.

  31. Michael Bean

    Yeah, on bitbucket, I find myself inspecting the HTML so I can get id's of comments to link to them as anchor points. Helps when you want to send someone an email and point them to the exact comment in question. Why do you find yourself inspecting in JIRA, Martin Gisser ?

  32. Michael Bean

    Martin Gisser I've found that ToirtoiseGitMerge works great as a diffing tool in windows. It lets you use it as a simple editor as well, in the case that you realize that you want to modify a change (only when you are diffing against HEAD).

  33. Rick Baker

    Everyone that is adding the +1, put your time to better use and vote for this issue, upper right hand corner of screen. +1s just get ignored, while a vote might actually mean something. Saying that, considering adding such trivial functionality has been ignored for almost a year and a half now, I'm not sure how much good the votes are doing either.

  34. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.