zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] _git: Don't cause errors if git isn't installed
@ 2010-08-10 18:13 Benjamin R. Haskell
  2010-09-01 18:43 ` Simon Ruderich
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin R. Haskell @ 2010-08-10 18:13 UTC (permalink / raw)
  To: Zsh Workers; +Cc: Benjamin R. Haskell

Setting up a new system under Cygwin on Windows 7, one of the first
things I tried (out of habit) was git<space><Tab>.  I'm not sure this is
the 'right' way to patch it, but other not-installed commands didn't
seem to cause the same kinds of errors:

$ screen <Tab># no extra output
$ php <Tab># no extra output
$ git <Tab>(eval):1: command not found: git
(eval):1: command not found: git

By "not the 'right' way", I just mean that this version accomplishes the goal
of eliminating the error messages, but maybe a more-correct solution would be
to replace some/all of the $(git...)-style calls with $(_call_program [tag]
git...)?

Best,
Ben
---
 Completion/Unix/Command/_git |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 465b316..b7eb681 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -30,6 +30,7 @@
 # zstyle ':completion::*:git-{name-rev,add,rm}:*' ignore-line true
 
 _git() {
+(( $+commands[git] )) || return 1
 local nul_arg abbrev_arg find_copies_harder_arg diff_l_arg pretty_arg exec_arg
 local author_conversion_file_arg long_author_conversion_file_arg verbose_arg
 local help_arg template_arg shared_arg thin_arg author_conversion_file_arg_spec
-- 
1.7.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-01 18:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-10 18:13 [PATCH] _git: Don't cause errors if git isn't installed Benjamin R. Haskell
2010-09-01 18:43 ` Simon Ruderich

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).