fix broken equality check when outside git repo

This commit is contained in:
sonnym 2012-03-30 13:25:39 -04:00
commit a0278ad040

View file

@ -4,7 +4,7 @@ function git_prompt_info() {
if [ -z $ref ]; then if [ -z $ref ]; then
# check if in detached HEAD mode # check if in detached HEAD mode
branch_name=$(git status -sb $(git_submodule_syntax) 2> /dev/null) branch_name=$(git status -sb $(git_submodule_syntax) 2> /dev/null)
if [ $branch_name = "## HEAD (no branch)" ]; then if [ "$branch_name" = "## HEAD (no branch)" ]; then
# set tag name if found # set tag name if found
tag_name=$(git name-rev --name-only $(git --no-pager show --stat 2> /dev/null | head -n 1 | awk '{ print $2 }') 2> /dev/null) tag_name=$(git name-rev --name-only $(git --no-pager show --stat 2> /dev/null | head -n 1 | awk '{ print $2 }') 2> /dev/null)
if [ -z $tag_name ]; then if [ -z $tag_name ]; then