Skip to content

Commit ca20906

Browse files
MarkLodatogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7ebee44 commit ca20906

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

contrib/completion/git-completion.bash

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2345,7 +2345,7 @@ _git ()
23452345
{
23462346
local i c=1 command __git_dir
23472347

2348-
if [[ -n $ZSH_VERSION ]]; then
2348+
if [[ -n ${ZSH_VERSION-} ]]; then
23492349
emulate -L bash
23502350
setopt KSH_TYPESET
23512351
fi
@@ -2394,7 +2394,7 @@ _git ()
23942394

23952395
_gitk ()
23962396
{
2397-
if [[ -n $ZSH_VERSION ]]; then
2397+
if [[ -n ${ZSH_VERSION-} ]]; then
23982398
emulate -L bash
23992399
setopt KSH_TYPESET
24002400
fi
@@ -2434,7 +2434,7 @@ complete -o bashdefault -o default -o nospace -F _git git.exe 2>/dev/null \
24342434
|| complete -o default -o nospace -F _git git.exe
24352435
fi
24362436

2437-
if [[ -n $ZSH_VERSION ]]; then
2437+
if [[ -n ${ZSH_VERSION-} ]]; then
24382438
shopt () {
24392439
local option
24402440
if [ $# -ne 2 ]; then

0 commit comments

Comments
 (0)