update prompt_ps1_git_branch() to handle detached HEADs with git 1.8

This commit is contained in:
Josh Holtrop 2013-12-30 10:48:58 -05:00
parent 5852b20e75
commit adbe3fe704

View File

@ -39,7 +39,7 @@ function prompt_ps1_git_branch()
if [[ "$branch_out" == "" ]]; then if [[ "$branch_out" == "" ]]; then
return return
fi fi
re="^\\* (.no.branch.|[^ ]*)" re="^\\* (.no.branch.|\\(detached[^)]*\\)|[^ ]*)"
if [[ "$branch_out" =~ $re ]]; then if [[ "$branch_out" =~ $re ]]; then
current_branch="${BASH_REMATCH[1]}" current_branch="${BASH_REMATCH[1]}"
re="((ahead|behind)[^]]*)\\]" re="((ahead|behind)[^]]*)\\]"