PyCharm doesn't highlight a difference (and messes up the repository?)

This snapshot of a diff of a window shows the difference between two commits of my git repository.

Most differences are correctly highlighted. For example row 886-901 highlights in blue the old length and the new length_of_items, and row 894-908 highlights in green the new self.cart_items and.

But line 897-911 has different indentation and is not highlighted as modified. I added the red lines to make the difference more clear.

I tried changing the settings of the diff, but I wasn't able to show this difference.

I am afraid that this problem is worse than just a diff problem because the local version was correct and the test was running without problems, but after I pushed to the remote repository, the remote version had the wrong indentation. I can't reproduce the bad push, but I can look at the diff and get the wrong result.

One thing to mention is that I have modified the size of tabs from 4 to 2 spaces (to comply with anvil.works standard).

Can you please let me know (1) how to get the correct diff and (2) how to make sure that the push doesn't corrupt the code indentation?

Please sign in to leave a comment.