magit-revert-buffers: refactor for speed and sanity

Use `magit-toplevel-safe' instead of `magit-get-top-dir'.  The latter
returns non-nil in bare repositories also, which is not helpful because
we only refresh files in the working directory anyway.

Use `file-in-directory-p' instead of `string-prefix-p', because the
former is safer.  Only check that the file is in the repository; do not
also check that it is _not_ in the git directory.  That's unnecessary
because a git repository cannot track a file ".git/FILE" anyway, and we
already check whether the file is a member of the list of tracked files.

Note that `magit-toplevel' and by extension `magit-toplevel-safe' use
`git rev-parse --show-level' which chases symlinks.  So we have to take
care when using `file-in-directory-p' or similar: we have to compare the
`buffer-file-truename' and not `buffer-file-name'.  We already did that.

Depending on whether there are more tracked files in the current
repositories or open buffers overall, take a different code path,
avoiding unnecessary work.  Move some of the shared code into the new
function `magit-revert-buffer'.
sanitize after-revert hooks

Rename the hook `magit-revert-buffer-hook' to `magit-after-revert-hook',
for consistency with the built-in `after-revert-hook'.  Run the hook,
after potentially re-enabling `magit-blame-mode' (which is a special
case explicitly handled in `magit-revert-buffer'), previously we did
it before.

Add the new hook variable `magit-not-reverted-hook' which is
run by `magit-revert-buffer' if, and only if, it does *not* run
`magit-after-revert-hook' (because there was nothing to be reverted,
i.e. the file did not change on disk).  This is for the benefit of
third-party extensions which do need to do something in that case.

Finish by always calling the _function_ `vc-find-file-hook'.  This
function is intended as a member of the hook `find-file-hook'.  It
is also called directly in a few other places, this is one of them.
Previously this function was only called when the buffer had to be
refreshed, now it is always called, mostly so that the mode-line
get's updated (that might need updating even if the file did not
change).
magit.el: cosmetics
Merge branch 'n/revert-buffer' into next