Version Details: Emacs 28.2 On Debian 12
Steps to reproduce: I am editing Groovy files in a Git workspace. When I load the files they come up as fundamental so I switch to java-mode. All works as expected, if the file is saved in emacs and then edited by another program, say in vim as an example, or even has another groovy file copied over it, emacs auto reverts as expected and maintains the editing mode.
However if I revert all changes to that file by doing a git checkout then emacs shows the dreaded red M and I have to manually revert the buffer.
If I repeat the above but DON'T change the buffer mode from fundamental then emacs picks up the changes and auto reverts on the git checkout as well.
It's as if it treats a change in buffer mode as a change too far under certain circumstances.
This is really annoying when git rebasing, when cleaning up history etc. This used not to happen on older versions of emacs (v25.2.1).
Can anyone help? Is there a magic setting somewhere to bring back the old behaviour?