Skip to content

Commit

Permalink
completion: fix zsh check under bash with 'set -u'
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mark Lodato authored and Junio C Hamano committed Oct 28, 2010
1 parent 7ebee44 commit ca20906
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2345,7 +2345,7 @@ _git ()
{
local i c=1 command __git_dir

if [[ -n $ZSH_VERSION ]]; then
if [[ -n ${ZSH_VERSION-} ]]; then
emulate -L bash
setopt KSH_TYPESET
fi
Expand Down Expand Up @@ -2394,7 +2394,7 @@ _git ()

_gitk ()
{
if [[ -n $ZSH_VERSION ]]; then
if [[ -n ${ZSH_VERSION-} ]]; then
emulate -L bash
setopt KSH_TYPESET
fi
Expand Down Expand Up @@ -2434,7 +2434,7 @@ complete -o bashdefault -o default -o nospace -F _git git.exe 2>/dev/null \
|| complete -o default -o nospace -F _git git.exe
fi

if [[ -n $ZSH_VERSION ]]; then
if [[ -n ${ZSH_VERSION-} ]]; then
shopt () {
local option
if [ $# -ne 2 ]; then
Expand Down

0 comments on commit ca20906

Please sign in to comment.