summaryrefslogtreecommitdiff
path: root/contrib/completion
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2020-05-26 19:13:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-05-28 16:15:18 (GMT)
commita44a0a9fc4353ff4ccd4b2308db2844d7f4185f9 (patch)
tree325bc33d2fdc9030f5c93e79a0d4733fff450ed6 /contrib/completion
parent2d5e9f31ac46017895ce6a183467037d29ceb9d3 (diff)
downloadgit-a44a0a9fc4353ff4ccd4b2308db2844d7f4185f9.zip
git-a44a0a9fc4353ff4ccd4b2308db2844d7f4185f9.tar.gz
git-a44a0a9fc4353ff4ccd4b2308db2844d7f4185f9.tar.bz2
completion: use native ZSH array pattern matching
When clearing the builtin operations on re-sourcing in the ZSH case we can use the native ${parameters} associative array keys values to get the currently `__gitcomp_builtin_*` operations using pattern matching instead of using sed. As also stated in commit 94408dc7, introducing this change the usage of sed has some overhead implications, while ZSH can do this check just using its native syntax. Signed-off-by: Marco Trevisan (Treviño) <mail@3v1n0.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/completion')
-rw-r--r--contrib/completion/git-completion.bash2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 70ad04e..ad6934a 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -373,7 +373,7 @@ __gitcomp ()
# Clear the variables caching builtins' options when (re-)sourcing
# the completion script.
if [[ -n ${ZSH_VERSION-} ]]; then
- unset $(set |sed -ne 's/^\(__gitcomp_builtin_[a-zA-Z0-9_][a-zA-Z0-9_]*\)=.*/\1/p') 2>/dev/null
+ unset ${(M)${(k)parameters[@]}:#__gitcomp_builtin_*} 2>/dev/null
else
unset $(compgen -v __gitcomp_builtin_)
fi