bash_aliases: prompt_ps1_git_branch(): minor fix in case commit comment contained a "]" character

This commit is contained in:
Josh Holtrop 2013-09-18 16:21:53 -04:00
parent d48d5d7157
commit 64c6f733fb

View File

@ -42,7 +42,7 @@ function prompt_ps1_git_branch()
re="^\\* (.no.branch.|[^ ]*)" re="^\\* (.no.branch.|[^ ]*)"
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)[^]]*)\\]"
if [[ "$branch_out" =~ $re ]]; then if [[ "$branch_out" =~ $re ]]; then
current_branch="$current_branch: ${BASH_REMATCH[1]}" current_branch="$current_branch: ${BASH_REMATCH[1]}"
fi fi