@@ -38,32 +38,32 @@ function parse_git_dirty() {
3838
3939# Gets the difference between the local and remote branches
4040function git_remote_status() {
41- local remote ahead behind git_remote_status git_remote_status_detailed git_remote_origin
42- git_remote_origin=$( _omb_prompt_git rev-parse --verify ${hook_com[branch]} @{upstream} --symbolic-full-name 2> /dev/null)
43- remote=${git_remote_origin/ refs\/ remotes\/ / }
44- if [[ -n ${remote} ]]; then
45- ahead=$( _omb_prompt_git rev-list ${hook_com[branch]} @{upstream}..HEAD 2> /dev/null | wc -l)
46- behind=$( _omb_prompt_git rev-list HEAD..${hook_com[branch]} @{upstream} 2> /dev/null | wc -l)
47-
48- if [[ $ahead -eq 0 ]] && [[ $behind -eq 0 ]]; then
49- git_remote_status=" $OSH_THEME_GIT_PROMPT_EQUAL_REMOTE "
50- elif [[ $ahead -gt 0 ]] && [[ $behind -eq 0 ]]; then
51- git_remote_status=" $OSH_THEME_GIT_PROMPT_AHEAD_REMOTE "
52- git_remote_status_detailed=" $OSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$OSH_THEME_GIT_PROMPT_AHEAD_REMOTE $(( ahead)) $_omb_prompt_reset_color "
53- elif [[ $behind -gt 0 ]] && [[ $ahead -eq 0 ]]; then
54- git_remote_status=" $OSH_THEME_GIT_PROMPT_BEHIND_REMOTE "
55- git_remote_status_detailed=" $OSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$OSH_THEME_GIT_PROMPT_BEHIND_REMOTE $(( behind)) $_omb_prompt_reset_color "
56- elif [[ $ahead -gt 0 ]] && [[ $behind -gt 0 ]]; then
57- git_remote_status=" $OSH_THEME_GIT_PROMPT_DIVERGED_REMOTE "
58- git_remote_status_detailed=" $OSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$OSH_THEME_GIT_PROMPT_AHEAD_REMOTE $(( ahead)) $_omb_prompt_reset_color$OSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$OSH_THEME_GIT_PROMPT_BEHIND_REMOTE $(( behind)) $_omb_prompt_reset_color "
59- fi
60-
61- if [[ -n $OSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]]; then
62- git_remote_status=" $OSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$OSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX "
63- fi
64-
65- echo $git_remote_status
41+ local remote ahead behind git_remote_status git_remote_status_detailed git_remote_origin
42+ git_remote_origin=$( _omb_prompt_git rev-parse --verify ${hook_com[branch]} @{upstream} --symbolic-full-name 2> /dev/null)
43+ remote=${git_remote_origin/ refs\/ remotes\/ / }
44+ if [[ -n ${remote} ]]; then
45+ ahead=$( _omb_prompt_git rev-list ${hook_com[branch]} @{upstream}..HEAD 2> /dev/null | wc -l)
46+ behind=$( _omb_prompt_git rev-list HEAD..${hook_com[branch]} @{upstream} 2> /dev/null | wc -l)
47+
48+ if [[ $ahead -eq 0 ]] && [[ $behind -eq 0 ]]; then
49+ git_remote_status=" $OSH_THEME_GIT_PROMPT_EQUAL_REMOTE "
50+ elif [[ $ahead -gt 0 ]] && [[ $behind -eq 0 ]]; then
51+ git_remote_status=" $OSH_THEME_GIT_PROMPT_AHEAD_REMOTE "
52+ git_remote_status_detailed=" $OSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$OSH_THEME_GIT_PROMPT_AHEAD_REMOTE $(( ahead)) $_omb_prompt_reset_color "
53+ elif [[ $behind -gt 0 ]] && [[ $ahead -eq 0 ]]; then
54+ git_remote_status=" $OSH_THEME_GIT_PROMPT_BEHIND_REMOTE "
55+ git_remote_status_detailed=" $OSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$OSH_THEME_GIT_PROMPT_BEHIND_REMOTE $(( behind)) $_omb_prompt_reset_color "
56+ elif [[ $ahead -gt 0 ]] && [[ $behind -gt 0 ]]; then
57+ git_remote_status=" $OSH_THEME_GIT_PROMPT_DIVERGED_REMOTE "
58+ git_remote_status_detailed=" $OSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$OSH_THEME_GIT_PROMPT_AHEAD_REMOTE $(( ahead)) $_omb_prompt_reset_color$OSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$OSH_THEME_GIT_PROMPT_BEHIND_REMOTE $(( behind)) $_omb_prompt_reset_color "
6659 fi
60+
61+ if [[ -n $OSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]]; then
62+ git_remote_status=" $OSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$OSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX "
63+ fi
64+
65+ echo $git_remote_status
66+ fi
6767}
6868
6969# Outputs the name of the current branch
0 commit comments