Avoid touching remote filesystems unnecessarily

This prevents "magit-save-buffers-predicate-tree-only" from touching any
remote filesystem other than the one containing the git repo under
consideration. This is a big help when many files are open on remote
TRAMP filesystems, which can be slow, or might even be temporarily
unavailable, resulting in either slowness or indefinite hangs when
running commands like "magit-status", even on local repos.

Also, since it avoids filesystem operations for any file outside the git
repo, it probably speeds things up a bit too.

This also adds a new utility function "magit-file-in-repo-p" which
encapsulates the logic of testing if a file is in a repo without
touching that file's filesystem unnecessarily.

Fixes #1472.