fix(zsh): add git_current_branch to git.plugin.zsh

This commit is contained in:
Badstagram 2025-11-19 13:24:12 +00:00
parent ce48485f6c
commit 820d21b14d

View File

@ -16,6 +16,17 @@ function current_branch() {
git_current_branch
}
function git_current_branch() {
local ref
ref=$(__git_prompt_git symbolic-ref --quiet HEAD 2> /dev/null)
local ret=$?
if [[ $ret != 0 ]]; then
[[ $ret == 128 ]] && return # no git repo.
ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) || return
fi
echo ${ref#refs/heads/}
}
# Check for develop and similarly named branches
function git_develop_branch() {
command git rev-parse --git-dir &>/dev/null || return