mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-16 02:27:03 +01:00
fix: when in git directory and not in a branch, show (no branch)
This commit is contained in:
parent
a0db2d4455
commit
99fc183e3d
1 changed files with 5 additions and 2 deletions
|
|
@ -1,7 +1,10 @@
|
||||||
# get the name of the branch we are on
|
# get the name of the branch we are on
|
||||||
function git_prompt_info() {
|
function git_prompt_info() {
|
||||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
|
if ! git status &> /dev/null; then
|
||||||
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
return
|
||||||
|
fi
|
||||||
|
branch=$(git branch | grep ^\* | cut -d" " -f2-)
|
||||||
|
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${branch}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue