Compare commits

...
Author SHA1 Message Date
Carlo Sala 69706a49df more fixes 2026-09-18 14:30:19 +02:00
Carlo Sala 59d7ef3171 fix comments 2026-09-18 14:17:05 +02:00
Robby RussellandClaude Opus 5 97dfe1ae54 fix(init): only accept an object ID as the resolved revision
A malformed HEAD or loose ref was copied into the zcompdump metadata as
though it had resolved, so a corrupt file could make #omz revision:
differ from git rev-parse HEAD instead of taking the fallback.

Fold the three resolution paths into one exit and check the result is a
40 or 64 character hex object ID, so symbolic refs, malformed files and
missed packed entries all fall through to git.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-07 08:25:57 -07:00
Robby RussellandClaude Opus 5 c6d78edc8f fix(init): keep the revision helper's REPLY out of the global scope
_omz_git_head reports through $REPLY, which stayed set for the rest of
startup and could overwrite caller state or be mistaken for the result
of an unrelated read. Call it inside an anonymous function that declares
REPLY local.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-07 07:56:48 -07:00
Robby RussellandCopilot Autofix powered by AI a8da200b18 Apply batched suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-09-06 08:38:58 -07:00
Robby RussellandClaude Fable 5.1 40323d0e37 perf(init): read the OMZ revision from .git instead of forking git
`git rev-parse HEAD` was run on every startup only to stamp the
zcompdump metadata. Resolve HEAD by reading the git directory in zsh:
handles `.git` files (worktrees, submodules), worktree common dirs,
detached HEADs and packed refs, and falls back to `git rev-parse` when
anything looks unexpected.

Measured on macOS arm64, zsh 5.9: 7.4 ms -> 0.2 ms per interactive
start.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-06 08:01:19 -07:00
Jérôme Tamarelle 426650fbe8 fix(symfony6): don't run command substitutions on tab completion (#14058)
The plugin is a copy of the completion script shipped by symfony/console.
It has not been updated since it was added, and two fixes made upstream
since then are missing.

The completion request was assembled as a string from the raw words of
the command line, then passed to "eval". Any command substitution present
in a word was therefore executed by the completion, before the user
validated the line. The request is now run as an array of arguments,
without being read again by the shell, and "_describe" is called directly
instead of through "eval". The alias of the command is resolved
explicitly, since that was the only useful effect of the "eval".

The request also runs with SHELL_VERBOSITY=0, so that completion keeps
working for users who exported SHELL_VERBOSITY=-1.

Ported from symfony/symfony#65818 and symfony/symfony#63859.
2026-09-06 07:02:47 -07:00
Robby RussellandMoulick Aggarwal 8a5b393088 feat(kubectl): add kesec alias for editing secrets (#14048)
Secret was the only resource in the plugin with get, describe and delete
aliases but no edit alias, while thirteen other resource types have one.

Closes #8309

Co-authored-by: Moulick Aggarwal <Moulick@users.noreply.github.com>
2026-09-05 23:04:08 -03:00
Josh McKinney 87d4d40418 feat(jj): Add common jj aliases (#13962) 2026-09-05 14:36:14 -07:00
6 changed files with 141 additions and 15 deletions
+82 -2
View File
@@ -110,9 +110,89 @@ if [[ -z "$ZSH_COMPDUMP" ]]; then
ZSH_COMPDUMP="${ZDOTDIR:-$HOME}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
fi
# Construct zcompdump OMZ metadata
zcompdump_revision="#omz revision: $(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)"
# Resolve the commit $ZSH is checked out at into $REPLY by reading the git
# directory, so that no git process is forked on every startup.
# Handles .git files (worktrees, submodules), worktree common dirs, detached
# HEADs and packed refs. Returns 1 if anything is unexpected.
_omz_git_head() {
local gitdir="$ZSH/.git" common head ref
local -a lines
REPLY=
# .git may be a file pointing at the real git dir
if [[ -f "$gitdir" ]]; then
read -r head 2>/dev/null < "$gitdir" || return 1
[[ "$head" = "gitdir: "* ]] || return 1
gitdir="${head#gitdir: }"
[[ -n "$gitdir" ]] || return 1
[[ "$gitdir" = /* ]] || gitdir="$ZSH/$gitdir"
fi
# worktrees keep their refs in the common git dir
common="$gitdir"
if [[ -f "$gitdir/commondir" ]]; then
read -r common 2>/dev/null < "$gitdir/commondir" || return 1
[[ "$common" = /* ]] || common="$gitdir/$common"
fi
[[ -r "$gitdir/HEAD" ]] || return 1
read -r head 2>/dev/null < "$gitdir/HEAD" || return 1
if [[ "$head" = ref:\ * ]]; then
ref="${head#ref: }"
# Only use well-formed full ref names as paths. Besides matching Git's ref
# rules, this prevents a malformed HEAD from escaping the git directory.
[[ "$ref" = refs/?* \
&& "$ref" != *..* \
&& "$ref" != *//* \
&& "$ref" != */ \
&& "$ref" != */.* \
&& "$ref" != *.lock \
&& "$ref" != *.lock/* \
&& "$ref" != *. \
&& "$ref" != *'@{'* \
&& "$ref" != *[[:cntrl:]\ \~\^\:\?\*\[\\]* \
]] || return 1
case "$ref" in
# These namespaces are private to each worktree and are never resolved
# from the common directory or its packed-refs file.
refs/bisect/*|refs/worktree/*|refs/rewritten/*)
[[ -r "$gitdir/$ref" ]] || return 1
read -r REPLY 2>/dev/null < "$gitdir/$ref" || return 1
;;
*)
if [[ -r "$common/$ref" ]]; then
read -r REPLY 2>/dev/null < "$common/$ref" || return 1
elif [[ -r "$common/packed-refs" ]]; then
lines=("${(@f)$(<"$common/packed-refs")}")
REPLY="${lines[(r)* ${(b)ref}]%% *}"
else
return 1
fi
;;
esac
else
# detached HEAD: the file holds the commit itself
REPLY="$head"
fi
# only an object ID is a usable answer: a symbolic ref, a malformed file or
# a missed packed entry all fall through to the git fallback instead
[[ -n "$REPLY" && -z "${REPLY//[0-9a-f]/}" ]] \
&& (( ${#REPLY} == 40 || ${#REPLY} == 64 ))
}
# Construct zcompdump OMZ metadata. The helper reports through $REPLY, so
# call it in a scope that keeps that out of the global namespace.
() {
local REPLY
_omz_git_head || REPLY="$(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)"
typeset -g zcompdump_revision="#omz revision: $REPLY"
}
zcompdump_fpath="#omz fpath: $fpath"
unset -f _omz_git_head
# Delete the zcompdump file if OMZ zcompdump metadata changed
if ! command grep -q -Fx "$zcompdump_revision" "$ZSH_COMPDUMP" 2>/dev/null \
+19
View File
@@ -19,35 +19,54 @@ plugins=(... jj)
| jjbd | `jj bookmark delete` |
| jjbf | `jj bookmark forget` |
| jjbl | `jj bookmark list` |
| jjblt | `jj bookmark list --tracked` |
| jjbm | `jj bookmark move` |
| jjbr | `jj bookmark rename` |
| jjbs | `jj bookmark set` |
| jjbt | `jj bookmark track` |
| jjbu | `jj bookmark untrack` |
| jjc | `jj commit` |
| jjcfg | `jj config` |
| jjcfgl | `jj config list` |
| jjcmsg | `jj commit --message` |
| jjd | `jj diff` |
| jjdmsg | `jj desc --message` |
| jjds | `jj desc` |
| jjdst | `jj diff --stat` |
| jje | `jj edit` |
| jjev | `jj evolog` |
| jjf | `jj file` |
| jjfl | `jj file list` |
| jjg | `jj git` |
| jjgcl | `jj git clone` |
| jjgf | `jj git fetch` |
| jjgfa | `jj git fetch --all-remotes` |
| jjgi | `jj git init` |
| jjgp | `jj git push` |
| jjgpa | `jj git push --all` |
| jjgpd | `jj git push --deleted` |
| jjgpt | `jj git push --tracked` |
| jjgrl | `jj git remote list` |
| jjl | `jj log` |
| jjla | `jj log -r "all()"` |
| jjn | `jj new` |
| jjnt | `jj new "trunk()"` |
| jjop | `jj op` |
| jjopl | `jj op log` |
| jjor | `jj op restore` |
| jjrb | `jj rebase` |
| jjrbm | `jj rebase -d "trunk()"` |
| jjrs | `jj restore` |
| jjrt | `cd "$(jj root \|\| echo .)"` |
| jjs | `jj show` |
| jjsp | `jj split` |
| jjsq | `jj squash` |
| jjst | `jj status` |
| jju | `jj undo` |
| jjw | `jj workspace` |
| jjwa | `jj workspace add` |
| jjwf | `jj workspace forget` |
| jjwl | `jj workspace list` |
## Prompt usage
+17
View File
@@ -45,34 +45,51 @@ alias jjbc='jj bookmark create'
alias jjbd='jj bookmark delete'
alias jjbf='jj bookmark forget'
alias jjbl='jj bookmark list'
alias jjblt='jj bookmark list --tracked'
alias jjbm='jj bookmark move'
alias jjbr='jj bookmark rename'
alias jjbs='jj bookmark set'
alias jjbt='jj bookmark track'
alias jjbu='jj bookmark untrack'
alias jjc='jj commit'
alias jjcfg='jj config'
alias jjcfgl='jj config list'
alias jjcmsg='jj commit --message'
alias jjd='jj diff'
alias jjdmsg='jj desc --message'
alias jjds='jj desc'
alias jjdst='jj diff --stat'
alias jje='jj edit'
alias jjev='jj evolog'
alias jjf='jj file'
alias jjfl='jj file list'
alias jjg='jj git'
alias jjgcl='jj git clone'
alias jjgf='jj git fetch'
alias jjgfa='jj git fetch --all-remotes'
alias jjgi='jj git init'
alias jjgp='jj git push'
alias jjgpa='jj git push --all'
alias jjgpd='jj git push --deleted'
alias jjgpt='jj git push --tracked'
alias jjgrl='jj git remote list'
alias jjl='jj log'
alias jjla='jj log -r "all()"'
alias jjn='jj new'
alias jjnt='jj new "trunk()"'
alias jjop='jj op'
alias jjopl='jj op log'
alias jjor='jj op restore'
alias jjrb='jj rebase'
alias jjrbm='jj rebase -d "trunk()"'
alias jjrs='jj restore'
alias jjrt='cd "$(jj root || echo .)"'
alias jjs='jj show'
alias jjsp='jj split'
alias jjsq='jj squash'
alias jjst='jj status'
alias jju='jj undo'
alias jjw='jj workspace'
alias jjwa='jj workspace add'
alias jjwf='jj workspace forget'
alias jjwl='jj workspace list'
+1
View File
@@ -71,6 +71,7 @@ plugins=(... kubectl)
| | | **Secret management** |
| kgsec | `kubectl get secret` | Get secret for decoding |
| kgseca | `kubectl get secret --all-namespaces` | List secrets across all namespaces |
| kesec | `kubectl edit secret` | Edit secret resource |
| kdsec | `kubectl describe secret` | Describe secret resource in detail |
| kdelsec | `kubectl delete secret` | Delete the secret |
| | | **Deployment management** |
+1
View File
@@ -93,6 +93,7 @@ alias kdelcm='kubectl delete configmap'
# Secret management
alias kgsec='kubectl get secret'
alias kgseca='kubectl get secret --all-namespaces'
alias kesec='kubectl edit secret'
alias kdsec='kubectl describe secret'
alias kdelsec='kubectl delete secret'
+21 -13
View File
@@ -15,8 +15,8 @@
# - https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/Console/Resources/completion.bash
#
_sf_console() {
local lastParam flagPrefix requestComp out comp
local -a completions
local lastParam out comp sf_cmd
local -a completions flagPrefix requestComp inputs
# The user could have moved the cursor backwards on the command-line.
# We need to trigger completion from the $CURRENT location, so we need
@@ -29,11 +29,20 @@ _sf_console() {
setopt local_options BASH_REMATCH
if [[ "${lastParam}" =~ '-.*=' ]]; then
# We are dealing with a flag with an =
flagPrefix="-P ${BASH_REMATCH}"
flagPrefix=(-P "${BASH_REMATCH}")
fi
# Prepare the command to obtain completions
requestComp="${words[0]} ${words[1]} _complete --no-interaction -szsh -a1 -c$((CURRENT-1))" i=""
# Prepare the command to obtain completions. An alias is resolved here,
# because the request is no longer read again by the shell.
sf_cmd="${words[1]}"
if [[ -n "${aliases[$sf_cmd]}" ]]; then
requestComp=(${(z)aliases[$sf_cmd]})
else
requestComp=(${~sf_cmd})
fi
requestComp+=(_complete --no-interaction -szsh -a1 "-c$((CURRENT-1))")
for w in ${words[@]}; do
w=$(printf -- '%b' "$w")
# remove quotes from typed values
@@ -47,19 +56,18 @@ _sf_console() {
fi
# empty values are ignored
if [ ! -z "$w" ]; then
i="${i}-i${w} "
inputs+=("-i$w")
fi
done
# Ensure at least 1 input
if [ "${i}" = "" ]; then
requestComp="${requestComp} -i\" \""
else
requestComp="${requestComp} ${i}"
if (( ! $#inputs )); then
inputs=(-i' ')
fi
# Use eval to handle any environment variables and such
out=$(eval ${requestComp} 2>/dev/null)
# The request is run without being read again by the shell, so that a
# "$(...)" or a backtick typed on the command line is not executed
out=$(SHELL_VERBOSITY=0 "${requestComp[@]}" "${inputs[@]}" 2>/dev/null)
while IFS='\n' read -r comp; do
if [ -n "$comp" ]; then
@@ -75,7 +83,7 @@ _sf_console() {
done < <(printf "%s\n" "${out[@]}")
# Let inbuilt _describe handle completions
eval _describe "completions" completions $flagPrefix
_describe "completions" completions "${flagPrefix[@]}"
return $?
}