summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Cox <kevincox@kevincox.ca>2025-10-07 16:48:42 -0400
committerOliver Kiddle <opk@zsh.org>2025-10-23 19:28:54 +0200
commita53cd5eacbcb326b9ba2c0eb4fa89da39c68ed62 (patch)
tree418bed8064db1298223edac8df322137adc9d1b1
parent53999: remove further remnants of ansi2knr support from AIX specific code (diff)
downloadzsh-a53cd5eacbcb326b9ba2c0eb4fa89da39c68ed62.tar
zsh-a53cd5eacbcb326b9ba2c0eb4fa89da39c68ed62.tar.gz
zsh-a53cd5eacbcb326b9ba2c0eb4fa89da39c68ed62.tar.bz2
zsh-a53cd5eacbcb326b9ba2c0eb4fa89da39c68ed62.tar.lz
zsh-a53cd5eacbcb326b9ba2c0eb4fa89da39c68ed62.tar.xz
zsh-a53cd5eacbcb326b9ba2c0eb4fa89da39c68ed62.tar.zst
zsh-a53cd5eacbcb326b9ba2c0eb4fa89da39c68ed62.zip
github #147: Clean up some leaked variables in completion functions
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Unix/Command/_git2
-rw-r--r--Completion/Unix/Command/_ssh2
-rw-r--r--Completion/Unix/Type/_hosts2
4 files changed, 7 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 9521d999d..166442b6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2025-10-23 Oliver Kiddle <opk@zsh.org>
+ * Kevin Cox: github #147: Completion/Unix/Command/_git,
+ Completion/Unix/Command/_ssh, Completion/Unix/Type/_hosts:
+ Clean up some leaked variables in completion functions
+
* 53999: Src/module.c: remove further remnants of ansi2knr
support from AIX specific code
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 7600ccb9c..1bede1e69 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -7181,7 +7181,7 @@ __git_remote_branch_names () {
__git_remote_branch_names_noprefix () {
declare -a heads
- branch_names=(${${${${(f)"$(_call_program remote-branch-refs-noprefix git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}#refs/remotes/}#*/}:#HEAD})
+ local branch_names=(${${${${(f)"$(_call_program remote-branch-refs-noprefix git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}#refs/remotes/}#*/}:#HEAD})
__git_command_successful $pipestatus || return 1
__git_describe_commit branch_names remote-branch-names-noprefix 'remote branch name' "$@"
diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh
index d5ace867b..75ab28ab9 100644
--- a/Completion/Unix/Command/_ssh
+++ b/Completion/Unix/Command/_ssh
@@ -3,7 +3,7 @@
# TODO: sshd, ssh-keysign
_ssh () {
- local curcontext="$curcontext" state line expl suf arg ret=1
+ local curcontext="$curcontext" state line lstate expl suf arg ret=1
local args sigargs common common_transfer options algopt tmp p1 file cmn cmds sdesc tdesc
typeset -A opt_args tsizes
diff --git a/Completion/Unix/Type/_hosts b/Completion/Unix/Type/_hosts
index d242e2931..0548036b6 100644
--- a/Completion/Unix/Type/_hosts
+++ b/Completion/Unix/Type/_hosts
@@ -41,7 +41,7 @@ if ! zstyle -a ":completion:${curcontext}:hosts" hosts _hosts; then
for khostfile in $khostfiles; do
if [[ -r $khostfile ]]; then
- khosts=(${(s/,/j/,/u)${(f)"$(<$khostfile)"}%%[ |#]*})
+ local khosts=(${(s/,/j/,/u)${(f)"$(<$khostfile)"}%%[ |#]*})
# known_hosts syntax supports the host being in the form [hostname]:port
# The filter below extracts the hostname from lines using this format.