Ability to ignore whitespace changes in the diffs (BB-11120)

Issue #6024 resolved
Shaun 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 (244)

  1. Jonathan Mooring staff
    • 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. 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!

  6. 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.

  7. 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.

  8. 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.

  9. 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.

  10. Marcus Bertrand staff

    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.

  11. 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 @Jonathan 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.


    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,

  13. 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."

  14. 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...

  15. 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??)

  16. 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...

  17. 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.

  18. Eric Wilson

    @Jonathan 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.

  19. Jon

    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

  20. 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.)

  21. 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.

  22. 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...!

  23. 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.

  24. 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!

  25. 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.

  26. Per

    +1 from my end also. Switching over to GitHub anyway, but some projects still remain here.

    Atlassian, why don't you care about your product?

  27. Ralph Callaway

    @Jonathan 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.

  28. 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.

  29. 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 ?

  30. 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).

  31. 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.

  32. Michael Bean

    Perhaps we can merge the known related tickets into one ticket, mark the smaller ones as duplicates then just use the vote button. With more problems listed that are all related, we could probably up the priority as well. Bitbucket personnel wouldn't have to read all our comments, either.

  33. Erik van Zijst staff

    Yeah, I saw that too and it's a little shitty to lose the votes on this issue. There's not really a way to just move those over though.

    If it's any consolation though, not closing it as a duplicate will only let the votes-dilution get worse.

  34. Andy Magoon

    If the other ticket was marked a duplicate, can the title of this be changed to more accurately reflect that this functionality needs to work on both the normal diff viewer AND the side-by-side diff viewer? (I can't remember the last time I've used the side-by-side viewer, but not having this feature is starting to wear us all down.)

  35. Michael Bean

    Hmm, I thought that it was unmarked as a duplicate. @Andy Magoon is correct. We should unify the two as this one doesn't currently show that it is a problem with the default diff viewer.

    Also, isn't this a bug if their other product is different? The duplicate ticket was calling it a bug. What do you think, @Shaun Ek?

  36. Boyd Ludlow

    I'm not sure if this is new but I find the smarmy message "While impressive, your diff is just to big!" when it won't load my diff to be extremely irritating, especially as I know that if whitespace was ignored the actual change is the addition of a single line.

    Be careful about trying to be humorous BitBucket. In this case it does not come across at all well and I wish you'd just fix the problem with your differencing tool instead!

  37. Patrick White

    Agreed @Boyd Ludlow , it's like their diff is too small: ie. they haven't improved their diff is ages. My diff's are almost always too big because of formatting & whitespace differences in GUI XML files, which cause my src files to always be hidden. It's almost infuriating.

  38. Martin Gisser

    "Almost infuriating" It's a classical technological tragi-grotesque. Coders without conscience (are they even seriously using their product?). Worse, coders without selfrespect.

    The phenomenon is not limited to Atlassian. I've seen it in Eclipse editor/search basics, Java graphics libraries, not to tell of Windoze, etc. etc. It's not even limited to software (stuff with Intel 80x86, 8088 comes to mind). Not even to computers.

  39. Eric Tucker

    Atlassian doesn't fix s**t. They've had an issue open for 7 years asking for a cancel confirmation in JIRA so you don't lose hours of work by hitting the wrong button and that hasn't been fixed yet.

  40. Chris White

    Wow, I mean WOW... My company has just started buying Atlassian products and although a little painful we're not too far down the road to turn back.

    It's not that there's an issue with a product, it's that you're COMPLETELY ignoring over 400 voiced complaints on a simple (we're all developers, we KNOW this is simple) issue going on well over a year and a half. Not only that but the vast majority of people never speak up on anything, or even visit such sites, so although us 400+ are speaking to you there's easily 1,000's who really want this feature.

    People. Apparently Atlassian profit keeps rising despite our complaints so they're really not inclined to be responsive to issues. We've got to start talking with our wallets. I've already posted this to my team and we'll be discussing it at our next planning meeting.

  41. Jens Schumacher staff

    Official update:

    We've added the "ability to ignore whitespace changes" to our roadmap. We we can't commit to a specific date, but it is on our radar. Thank you for your patience!

    Cheers, Jens

  42. Jon


    I put the following in a script I can run on bb pages:

    if (window.location.href.indexOf('#') !== -1) { window.location.href = window.location.href.substr(0, window.location.href.indexOf('#')) + '?w=1';
    } else { window.location.href = window.location.href + '?w=1'; }

    it loses hashes, but meh.

    (actually, I automatically inject a button at the top of PRs with this as its click handler using the Chrome JSTricks extension ;)

  43. Michael Bean

    @Jon thanks for the inspiration....I may have done something similar in a chrome extension of mine, too....without loosing hashes.

    As an aside, you probably don't want to run that version unless you are sure w is not already set, otherwise you might end up with something like this (which might be hard to understand):


  44. Zachary Davis

    As you've already discovered, we have implemented this as a query param in the url. This should work for any page with a diff (and the setting should carry over when viewing side-by-side diffs on that page). The setting is currently not sticky, meaning you'll have to add the param to each page you view where you'd like to ignore white space changes.

    We will be working to add control for this to the UI as part of a larger reconsideration of pull requests, but we didn't want that to hold up putting this functionality in users' hands.

    Thanks for your patience.

  45. Michael Bean

    @Zachary Davis, what is the timeline for making this sticky or adding a toggle for it? I do use an extension to force it, but it requires that the page reload, which is annoying since the extension can't run until after the page loads. So I have to wait twice as long before I can view a pull request the way I like it. The one that @Brad Barwick suggests also has to do this.

    Maybe I should open an issue so people can vote on the improvement to the parameter.

    Is there a way to tell the pull request, via javascript, to update diffs to ignore whitespace? Basically I want to know if the front-end is what is using the w=1 parameter.

  46. Zachary Davis

    Sorry for not responding. There is no timeline at the moment for this. We've tentatively explored several things, including a whitespace "toggle" button in the pull request view as well as a way to ignore whitespace by default at the account level. But neither of those are things we're focusing at the moment.

    In the mean time, depending on how you use Pull Requests, you could write an extension that rewrites urls on the pull request list view (or wherever) to have the w=1 param. That should avoid the double-loading problem?

  47. Michael Bean

    Rewriting all hrefs requires a lot more domain knowledge than having the PR default at the get-go...What if a friend sends me an IM with an href to a PR? My IM isn't going to let me hack it so I can automatically add w=1 to it...I am cognizant of this and add it on when helpful, but others on my team may not be aware.

  48. Nigel Stewart

    +1 Seriously need a button for this. Without a button this diff tool is merely a toy. It's my job to look at diffs, and it's your job to make my job more productive. This is not a nice-to-have, this is not a when-we-get-around-to-it. This is needed urgently and devs are shaking their fist at bitbucket and and every time they paste ?w=1 into the URL. Please make a serious diff tool, not just a toy.

  49. Mark Rodrigues

    Are there jobs logged to get this toggle in the UI or to make it sticky? If so can you please post the ID numbers for them so interested parties can up-vote it? Cheers

  50. Howard Jess

    @Jens Schumacher I don't understand: if there's "no open issue to make this available via the UI", in the face of over 500 votes and 2-1/2 years of polite and not-so-polite requests for this feature, then WHY NOT???. And what else is higher priority that you are working on?

  51. Zachary Davis

    Hi all,

    I've opened a separate issue (#11864 -- "'Ignore whitespace' toggle in the UI") to track the request that ignore whitespace be surfaced in the UI. Please take any discussion around the UI to that ticket.

    This ticket was indeed opened in 2013 and has a lot of votes and watchers, but the vast majority of those those came before this issue was resolved last year when we added the query param functionality (which, as far as I know, brought us on par with other similar services). We still consider this particular issue to be resolved, and as stated above have explored options for surfacing "Ignore whitespace" in the UI but we are not actively working on that at this time. We will revisit in the future, but there's no timeline at the moment. Future updates will be posted to #11864.


  52. Stryder Crown

    The biggest indicator to me that Atlassian doesn't build tools for developers is missing features like this. As a Dev Lead or Architect, I shouldn't have to alter my uri by hand just to get a clearer view of what code has changed in a tool built around reviewing code.

    +1 this. It's been 2 years and there's still nothing there.

  53. Mark Cocquio

    Wow, how long is this taking? Impressive! So it sort of works but not quite (blank lines are not whitespace?!). Hmmm. Come on Atlassian, be a good sport and implement this, like, now-ish.

    Then get to work on ignoring files which have moved but not changed in content :)

  54. Roy Tzur

    Olivier Bellemare, you're right - it does. Though the ui is confusing because you choose "Ignore whitespace" for a file and not for a PR/branch.......

  55. Log in to comment