Return early if folder isn't a git repo

Minor performance improvement
This commit is contained in:
Sindre Sorhus
2013-03-10 17:38:08 +01:00
parent dc2a50ad35
commit ecbec4ef99

View File

@@ -34,6 +34,7 @@ zstyle ':vcs_info:git*' actionformats ' %b|%a'
# Fastest possible way to check if repo is dirty
git_dirty() {
[ -d .git ] || return
git diff --quiet --ignore-submodules HEAD 2>/dev/null; [ $? -eq 1 ] && echo '*'
}