bash_aliases: fix prompt_ps1_git_branch() to work in a detached HEAD state
This commit is contained in:
parent
13b1427e11
commit
a8c7e6f1ab
@ -41,7 +41,7 @@ function prompt_ps1_git_branch()
|
||||
if [[ "$branch_out" == "" ]]; then
|
||||
return
|
||||
fi
|
||||
current_branch=$(echo "$branch_out" | awk '{print $1}')
|
||||
current_branch=$(echo "$branch_out" | sed -re 's/(.no.branch.|[^ ]*).*/\1/')
|
||||
ahead_behind=$(echo "$branch_out" | grep -E '(ahead|behind)' | sed -re 's/^.*(ahead|behind)(.[0-9]+).*$/\1\2/')
|
||||
if [[ "$ahead_behind" != "" ]]; then
|
||||
ahead_behind=": ${ahead_behind}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user