diff options
Diffstat (limited to 'bash/bashrc.d/prompt.bash')
-rw-r--r-- | bash/bashrc.d/prompt.bash | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index 3f658fa2..e28b2dda 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -63,9 +63,13 @@ prompt() { # Attempt to determine git branch, bail if we can't local branch - branch=$(git symbolic-ref --quiet HEAD 2>/dev/null) \ - || branch=$(git rev-parse --short HEAD 2>/dev/null) \ - || return 1 + branch=$( { + git symbolic-ref --quiet HEAD \ + || git rev-parse --short HEAD + } 2>/dev/null ); + if ! [[ $branch ]]; then + return 1 + fi branch=${branch##*/} # Safely read status with -z --porcelain |