From 59d7ef3171d2f3ec605bf7f601a71fca3fc6a082 Mon Sep 17 00:00:00 2001 From: Carlo Sala Date: Fri, 18 Sep 2026 14:17:05 +0200 Subject: [PATCH] fix comments --- oh-my-zsh.sh | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c8a185824..52ec6704a 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -138,14 +138,24 @@ _omz_git_head() { if [[ "$head" = ref:\ * ]]; then ref="${head#ref: }" - 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 + 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"