fixes
This commit is contained in:
parent
11e23a2c25
commit
40b5d21fd3
20
prompt.sh
20
prompt.sh
@ -45,7 +45,7 @@ function enrich {
|
|||||||
else
|
else
|
||||||
coloron=$on
|
coloron=$on
|
||||||
fi
|
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
|
if [[ $flag == true ]]; then color=$coloron; else color=$off; fi
|
||||||
PS1="${PS1}${color}${symbol}${reset} "
|
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)
|
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
|
current_branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null)
|
||||||
if [[ $is_a_git_repo == true && $number_of_logs -gt 0 ]]; then
|
if [[ $current_branch == 'HEAD' ]]; then detached=true; else detached=false; fi
|
||||||
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)
|
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
|
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
|
if [[ $commits_ahead -gt 0 && $commits_behind -gt 0 ]]; then
|
||||||
has_diverged=true
|
has_diverged=true
|
||||||
fi
|
fi
|
||||||
if [[ $commits_ahead == 0 && $commits_behind -gt 0 ]]; then
|
if [[ $commits_ahead -eq 0 && $commits_behind -gt 0 ]]; then
|
||||||
can_fast_forward=true
|
can_fast_forward=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -137,9 +137,9 @@ function build_prompt {
|
|||||||
fi
|
fi
|
||||||
if [[ $detached == true ]]; then
|
if [[ $detached == true ]]; then
|
||||||
if [[ $just_init == true ]]; then
|
if [[ $just_init == true ]]; then
|
||||||
PS1="${PS1}${red}detached"
|
PS1="${PS1} ${red}detached"
|
||||||
else
|
else
|
||||||
PS1="${PS1}${on}(${current_commit_hash:0:7})"
|
PS1="${PS1} ${on}(${current_commit_hash:0:7})"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ $has_upstream == true ]]; then
|
if [[ $has_upstream == true ]]; then
|
||||||
@ -166,10 +166,10 @@ function build_prompt {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $display_tag == true ]]; then
|
if [[ $display_tag == true ]]; then
|
||||||
PS1="${PS1}${yellow}${is_on_a_tag_symbol}${reset}"
|
PS1="${PS1} ${yellow}${is_on_a_tag_symbol}${reset}"
|
||||||
fi
|
fi
|
||||||
if [[ $display_tag_name == true && $is_on_a_tag == true ]]; then
|
if [[ $display_tag_name == true && $is_on_a_tag == true ]]; then
|
||||||
PS1="${PS1}${yellow}[${tag_at_current_commit}]${reset}"
|
PS1="${PS1} ${yellow}[${tag_at_current_commit}]${reset}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user