I use fugitive vim plugin. with a map and BufferIsEmpty function, I close the diff buffer if this don't have changes.
I use this map
nn <silent><leader>g0 :w <bar> Gsplit! diff -U0 <bar>
\ exec BufferIsEmpty() ? "q <bar> echomsg 'git: No changes'" : ''<CR>
but, I don't see the message No changes
I solved with redraw
nn <silent><leader>g0 :w <bar> Gsplit! diff -U0 <bar>
\ exec BufferIsEmpty() ? "q <bar> redraw <bar> echomsg 'git: No changes'" : ''<CR>