This commit is contained in:
Yehor Lvivski 2013-11-08 01:36:12 +02:00
parent 11e23a2c25
commit 40b5d21fd3

View File

@ -45,7 +45,7 @@ function enrich {
else
coloron=$on
fi
if [ $use_color_off == false -a $flag == false ]; then symbol=" "; fi
if [[ $use_color_off == false && $flag == false ]]; then symbol=' '; fi
if [[ $flag == true ]]; then color=$coloron; else color=$off; fi
PS1="${PS1}${color}${symbol}${reset} "
}
@ -59,11 +59,11 @@ function build_prompt {
number_of_logs=$(git log --pretty=oneline -n1 2> /dev/null | wc -l)
if [[ $is_a_git_repo == true && $number_of_logs == 0 ]]; then just_init=true; fi
if [[ $is_a_git_repo == true && $number_of_logs -gt 0 ]]; then
current_branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null)
if [[ $current_branch == 'HEAD' ]]; then detached=true; else detached=false; fi
if [[ $is_a_git_repo == true && $number_of_logs -eq 0 ]]; then just_init=true; fi
if [[ $is_a_git_repo == true && $number_of_logs -gt 0 ]]; then
upstream=$(git rev-parse --symbolic-full-name --abbrev-ref @{upstream} 2> /dev/null)
if [[ $upstream != '@{upstream}' ]]; then has_upstream=true; else has_upstream=false; upstream=''; fi
@ -105,7 +105,7 @@ function build_prompt {
if [[ $commits_ahead -gt 0 && $commits_behind -gt 0 ]]; then
has_diverged=true
fi
if [[ $commits_ahead == 0 && $commits_behind -gt 0 ]]; then
if [[ $commits_ahead -eq 0 && $commits_behind -gt 0 ]]; then
can_fast_forward=true
fi