When using magit on a local file, I stage my changes and
I then press c and c again to commit. I get a new window showing the diff and a window for the commit message. I write my commit message press C-c C-c and the diff and commit window close.

However when using magit on a remote file using tramp, if I stage a change then press c and c again to commit, I only get a new window for the commit message not the diff window. I can write the commit message as normal, but not being able to see the diff at this point is annoying.

One thing I noticed is that if I do not stage my changes when using magit on tramp and I go to commit, I DO get a diff window, with the message in the message buffer "Nothing staged. Stage and commit all unstaged changes?(Y or n)" I can then then type Y to make the commit. But this way is only allowing me to see a diff for all changes to be placed in one commit, rather than the bits I want to stage for a commit.

How can I get magit to open the diff window when the commit message window is opened on a remote file using tramp?

1 Answer
1

You can explicitly show the diff using C-d C-d in the COMMIT_EDITMSG buffer.

Normally the diff is automatically shown by magit-commit-diff, which is a member of server-switch-hook. That hook isn't run when committing over Tramp because in that case we cannot use the emacsclient to connect to the server (server.el) running inside Emacs. Instead an alternative implementation is used, which communicates on standard output/input. That doesn't call that hook.