Respect GIT_CEILING_DIRECTORIES, see git(1).

From git(1):
  
    GIT_CEILING_DIRECTORIES
           This should be a colon-separated list of absolute paths. If set, it is a list of directories that Git
           should not chdir up into while looking for a repository directory (useful for excluding slow-loading
           network directories). It will not exclude the current working directory or a GIT_DIR set on the command
           line or in the environment. Normally, Git has to read the entries in this list and resolve any symlink
           that might be present in order to compare them with the current directory. However, if even this access
           is slow, you can add an empty entry to the list to tell Git that the subsequent entries are not symlinks
           and needn’t be resolved; e.g., GIT_CEILING_DIRECTORIES=/maybe/symlink::/very/slow/non/symlink.

This patch currently does not duplicate git's behavior of resolving symlinks.