zsh-workers
 help / color / mirror / code / Atom feed
From: "Benjamin R. Haskell" <zsh@benizi.com>
To: Zsh Workers <zsh-workers@zsh.org>
Cc: "Benjamin R. Haskell" <zsh@benizi.com>
Subject: [PATCH] _git: Don't cause errors if git isn't installed
Date: Tue, 10 Aug 2010 14:13:45 -0400	[thread overview]
Message-ID: <1281464025-24258-1-git-send-email-zsh@benizi.com> (raw)

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


             reply	other threads:[~2010-08-10 18:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-10 18:13 Benjamin R. Haskell [this message]
2010-09-01 18:43 ` Simon Ruderich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1281464025-24258-1-git-send-email-zsh@benizi.com \
    --to=zsh@benizi.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).