Skip to content

Commit 6d45cb8

Browse files
lemtoccodex
andcommitted
fix(ci): skip unavailable git-wt cache hook
- Skip git-wt cache prewarming when the git-wt helper is absent - Guard the zsh lazy git-wt hook so runners without the Homebrew package still start - Keep local git-wt cache generation enabled when the helper exists Co-authored-by: Codex GPT-5.5 <noreply@openai.com>
1 parent 0988137 commit 6d45cb8

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

.github/scripts/warm-zsh-startup-cache.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,14 @@ while IFS= read -r command_string; do
5757
warm_cache_eval "$command_string"
5858
done < <(sed -nE 's/^[[:space:]]*(zsh-defer[[:space:]]+)?cache_eval "([^"]+)".*$/\2/p' "$zshrc")
5959

60-
if [[ -r "$zsh_lazy" ]] && command -v git >/dev/null 2>&1; then
60+
if [[ -r "$zsh_lazy" ]] && command -v git >/dev/null 2>&1 && command -v git-wt >/dev/null 2>&1; then
6161
git_wt_cache="$cache_home/sheldon/git-wt.zsh"
6262
mkdir -p "$(dirname "$git_wt_cache")"
6363
if [[ ! -s "$git_wt_cache" || "$(readlink "$zshrc")" != "$(cat "${git_wt_cache}.lock" 2>/dev/null)" ]]; then
6464
echo "warming git-wt zsh cache"
6565
git wt --init zsh > "$git_wt_cache"
6666
readlink "$zshrc" > "${git_wt_cache}.lock"
6767
fi
68+
elif [[ -r "$zsh_lazy" ]]; then
69+
echo "skipping git-wt zsh cache: git-wt is unavailable"
6870
fi

home/shell/zsh/lazy.zsh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,13 @@ if (( $+commands[awsctx] )); then
9797
fi
9898

9999
# git-wt (cache, regenerate when .zshrc symlink target changes)
100-
git_wt_cache="${XDG_CACHE_HOME:-$HOME/.cache}/sheldon/git-wt.zsh"
101-
if [[ ! -r "$git_wt_cache" || "$(readlink ~/.zshrc)" != "$(cat "${git_wt_cache}.lock" 2>/dev/null)" ]]; then
102-
mkdir -p "${git_wt_cache:h}"
103-
git wt --init zsh > "$git_wt_cache"
104-
readlink ~/.zshrc > "${git_wt_cache}.lock"
100+
if (( ${+commands[git-wt]} )); then
101+
git_wt_cache="${XDG_CACHE_HOME:-$HOME/.cache}/sheldon/git-wt.zsh"
102+
if [[ ! -r "$git_wt_cache" || "$(readlink ~/.zshrc)" != "$(cat "${git_wt_cache}.lock" 2>/dev/null)" ]]; then
103+
mkdir -p "${git_wt_cache:h}"
104+
git wt --init zsh > "$git_wt_cache"
105+
readlink ~/.zshrc > "${git_wt_cache}.lock"
106+
fi
107+
source "$git_wt_cache"
108+
unset git_wt_cache
105109
fi
106-
source "$git_wt_cache"
107-
unset git_wt_cache

0 commit comments

Comments
 (0)