Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Fix glitches in the git backend of vcs_info



Florian Kriener noticed problems when using the 'check-for-changes'
feature of vcs_info's git backend. It threw errors when in freshly
initialized git repositories and you change into the .git subdirectory.

This should fix it.
---
 Functions/VCS_Info/Backends/VCS_INFO_get_data_git |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index a536165..33e76d4 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -135,7 +135,9 @@ if [[ -z ${gitdir} ]] || [[ -z ${gitbranch} ]] ; then
     return 1
 fi
 
-if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "check-for-changes" ; then
+if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "check-for-changes" && \
+   [[ "$(git rev-parse --is-inside-git-dir 2> /dev/null)" != 'true' ]] && \
+   git rev-parse --quiet --verify HEAD &> /dev/null ; then
     # Default: off - these are potentially expensive on big repositories
     ${vcs_comm[cmd]} diff --no-ext-diff --ignore-submodules --quiet --exit-code ||
         gitunstaged=1
-- 
1.6.3.1.169.g33fd



Messages sorted by: Reverse Date, Date, Thread, Author