completion: fix zsh check under bash with 'set -u'
Commit 06f44c3 (completion: make compatible with zsh) broke bash compatibility with 'set -u': a warning was generated when checking $ZSH_VERSION. The solution is to supply a default value, using ${ZSH_VERSION-}. Thanks to SZEDER Gábor for the fix. Signed-off-by: Mark Lodato <lodatom@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Mark Lodato committed
Oct 27, 2010 at 21:08 UTC
ca209065f3cc3462eb0ae6090f6b13f38aa2114c
1 file changed
+3
-3
contrib/completion/git-completion.bash
+3
-3
@@ -2345,7 +2345,7 @@ _git ()
2345
{
2346
local i c=1 command __git_dir
2347
2348
- if [[ -n $ZSH_VERSION ]]; then
2348
+ if [[ -n ${ZSH_VERSION-} ]]; then
2349
emulate -L bash
2350
setopt KSH_TYPESET
2351
fi
@@ -2394,7 +2394,7 @@ _git ()
2394
2395
_gitk ()
2396
{
2397
- if [[ -n $ZSH_VERSION ]]; then
2397
+ if [[ -n ${ZSH_VERSION-} ]]; then
2398
emulate -L bash
2399
setopt KSH_TYPESET
2400
fi
@@ -2434,7 +2434,7 @@ complete -o bashdefault -o default -o nospace -F _git git.exe 2>/dev/null \
2434
|| complete -o default -o nospace -F _git git.exe
2435
fi
2436
2437
-if [[ -n $ZSH_VERSION ]]; then
2437
+if [[ -n ${ZSH_VERSION-} ]]; then
2438
shopt () {
2439
local option
2440
if [ $# -ne 2 ]; then