summaryrefslogtreecommitdiff
path: root/contrib/completion
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2020-10-28 02:06:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-10-28 21:30:59 (GMT)
commit2f459b0060948299be4bfa00c21f574140dcbe63 (patch)
tree203f32ef15aaca9ae11491ce3b1a0b17b951b30c /contrib/completion
parent94b2901cfe23c077207a563e544fd8dc11a832ce (diff)
downloadgit-2f459b0060948299be4bfa00c21f574140dcbe63.zip
git-2f459b0060948299be4bfa00c21f574140dcbe63.tar.gz
git-2f459b0060948299be4bfa00c21f574140dcbe63.tar.bz2
completion: zsh: simplify compadd functions
We don't need to override IFS, zsh has a native way of splitting by new lines: the expansion flag (f). Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/completion')
-rw-r--r--contrib/completion/git-completion.zsh15
1 files changed, 5 insertions, 10 deletions
diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index d9ce5e1..1ef02f9 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -100,9 +100,8 @@ __gitcomp_direct ()
{
emulate -L zsh
- local IFS=$'\n'
compset -P '*[=:]'
- compadd -Q -- ${${=1}% } && _ret=0
+ compadd -Q -- ${${(f)1}% } && _ret=0
}
__gitcomp_direct_append ()
@@ -114,34 +113,30 @@ __gitcomp_nl ()
{
emulate -L zsh
- local IFS=$'\n'
compset -P '*[=:]'
- compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
+ compadd -Q -S "${4- }" -p "${2-}" -- ${(f)1} && _ret=0
}
__gitcomp_nl_append ()
{
emulate -L zsh
- local IFS=$'\n'
compset -P '*[=:]'
- compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
+ compadd -Q -S "${4- }" -p "${2-}" -- ${(f)1} && _ret=0
}
__gitcomp_file_direct ()
{
emulate -L zsh
- local IFS=$'\n'
- compadd -f -- ${=1} && _ret=0
+ compadd -f -- ${(f)1} && _ret=0
}
__gitcomp_file ()
{
emulate -L zsh
- local IFS=$'\n'
- compadd -p "${2-}" -f -- ${=1} && _ret=0
+ compadd -p "${2-}" -f -- ${(f)1} && _ret=0
}
__git_zsh_bash_func ()