zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Fix glitches in the git backend of vcs_info
@ 2009-06-19 14:25 Frank Terbeck
  0 siblings, 0 replies; only message in thread
From: Frank Terbeck @ 2009-06-19 14:25 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-06-19 14:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-19 14:25 PATCH: Fix glitches in the git backend of vcs_info Frank Terbeck

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).