From a8da200b18403c63dba185b7dca5b182d7c136e9 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Sun, 6 Sep 2026 08:38:58 -0700 Subject: [PATCH] Apply batched suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- oh-my-zsh.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 12da390c8..3539f058c 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -141,12 +141,14 @@ _omz_git_head() { ref="${head#ref: }" if [[ -r "$common/$ref" ]]; then - read -r REPLY 2>/dev/null < "$common/$ref" && return 0 + read -r REPLY 2>/dev/null < "$common/$ref" || return 1 + [[ "$REPLY" != ref:\ * ]] || return 1 + return 0 fi [[ -r "$common/packed-refs" ]] || return 1 lines=("${(@f)$(<"$common/packed-refs")}") - REPLY="${lines[(r)* $ref]%% *}" + REPLY="${lines[(r)* ${(b)ref}]%% *}" [[ -n "$REPLY" ]] }