Improve logic for checking if inside a git repo
This commit is contained in:
@@ -34,8 +34,10 @@ zstyle ':vcs_info:git*' actionformats ' %b|%a'
|
||||
|
||||
# Fastest possible way to check if repo is dirty
|
||||
git_dirty() {
|
||||
[ -d .git ] || return
|
||||
command git diff --quiet --ignore-submodules HEAD 2>/dev/null; [ $? -eq 1 ] && echo '*'
|
||||
# check if we're in a git repo
|
||||
command git rev-parse --is-inside-work-tree &>/dev/null || return
|
||||
# check if it's dirty
|
||||
command git diff --quiet --ignore-submodules HEAD &>/dev/null; [ $? -eq 1 ] && echo '*'
|
||||
}
|
||||
|
||||
# Displays the exec time of the last command if set threshold was exceeded
|
||||
|
||||
Reference in New Issue
Block a user