diff options
Diffstat (limited to 'Functions/VCS_Info/Backends/VCS_INFO_get_data_git')
-rw-r--r-- | Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 23545e53c..75d39cc4a 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -3,7 +3,7 @@ ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions extendedglob NO_shwordsplit -local gitdir gitbase gitbranch gitaction +local gitdir gitbase gitbranch gitaction gitunstaged gitstaged VCS_INFO_git_getaction () { local gitaction='' gitdir=$1 @@ -96,9 +96,17 @@ if [[ -z ${gitdir} ]] || [[ -z ${gitbranch} ]] ; then return 1 fi +if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "check-for-changes" ; then + # Default: off - these are potentially expensive on big repositories + ${vcs_comm[cmd]} diff --no-ext-diff --ignore-submodules --quiet --exit-code || + gitunstaged=1 + ${vcs_comm[cmd]} diff-index --cached --quiet --ignore-submodules HEAD || + gitstaged=1 +fi + VCS_INFO_adjust gitaction="$(VCS_INFO_git_getaction ${gitdir})" gitbase=${PWD%/${$( ${vcs_comm[cmd]} rev-parse --show-prefix )%/##}} rrn=${gitbase:t} -VCS_INFO_formats "${gitaction}" "${gitbranch}" "${gitbase}" +VCS_INFO_formats "${gitaction}" "${gitbranch}" "${gitbase}" "${gitstaged}" "${gitunstaged}" return 0 |