Skip to content

Commit 4d605b0

Browse files
committed
Merge branch 'sg/completion-zsh-workaround'
Work around zsh segfaulting when loading git-completion.zsh * sg/completion-zsh-workaround: completion: correct zsh detection when run from git-completion.zsh
2 parents 8d0d53a + 61d48c6 commit 4d605b0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

contrib/completion/git-completion.bash

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3223,7 +3223,10 @@ __gitk_main ()
32233223
__git_complete_revlist
32243224
}
32253225

3226-
if [[ -n ${ZSH_VERSION-} ]]; then
3226+
if [[ -n ${ZSH_VERSION-} ]] &&
3227+
# Don't define these functions when sourced from 'git-completion.zsh',
3228+
# it has its own implementations.
3229+
[[ -z ${GIT_SOURCING_ZSH_COMPLETION-} ]]; then
32273230
echo "WARNING: this script is deprecated, please see git-completion.zsh" 1>&2
32283231

32293232
autoload -U +X compinit && compinit

contrib/completion/git-completion.zsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if [ -z "$script" ]; then
3939
test -f $e && script="$e" && break
4040
done
4141
fi
42-
ZSH_VERSION='' . "$script"
42+
GIT_SOURCING_ZSH_COMPLETION=y . "$script"
4343

4444
__gitcomp ()
4545
{

0 commit comments

Comments
 (0)