Check if there is a git repository dir.

This pull request fix problem when you are on child dir of the repository. https://github.com/robbyrussell/oh-my-zsh/pull/1504/