fix(branch): handle branches with / properly (#13063)

Co-authored-by: Takha Polat <takha.polat@bell-sw.com>
This commit is contained in:
swivelmargarita 2025-04-17 19:57:53 +05:00 committed by GitHub
parent a84a0332a8
commit c1e5ff3169
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,7 +8,7 @@ function branch_prompt_info() {
while [[ "$dir" != '/' ]]; do while [[ "$dir" != '/' ]]; do
# Found .git directory # Found .git directory
if [[ -d "${dir}/.git" ]]; then if [[ -d "${dir}/.git" ]]; then
branch="${"$(<"${dir}/.git/HEAD")"##*/}" branch="${"$(<"${dir}/.git/HEAD")"##ref: refs/heads/}"
echo '±' "${branch:gs/%/%%}" echo '±' "${branch:gs/%/%%}"
return return
fi fi