mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
lib/git: Change indentation
This commit is contained in:
48
lib/git.sh
48
lib/git.sh
@ -38,32 +38,32 @@ function parse_git_dirty() {
|
||||
|
||||
# Gets the difference between the local and remote branches
|
||||
function git_remote_status() {
|
||||
local remote ahead behind git_remote_status git_remote_status_detailed git_remote_origin
|
||||
git_remote_origin=$(_omb_prompt_git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)
|
||||
remote=${git_remote_origin/refs\/remotes\//}
|
||||
if [[ -n ${remote} ]]; then
|
||||
ahead=$(_omb_prompt_git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
|
||||
behind=$(_omb_prompt_git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
|
||||
local remote ahead behind git_remote_status git_remote_status_detailed git_remote_origin
|
||||
git_remote_origin=$(_omb_prompt_git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)
|
||||
remote=${git_remote_origin/refs\/remotes\//}
|
||||
if [[ -n ${remote} ]]; then
|
||||
ahead=$(_omb_prompt_git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
|
||||
behind=$(_omb_prompt_git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
|
||||
|
||||
if [[ $ahead -eq 0 ]] && [[ $behind -eq 0 ]]; then
|
||||
git_remote_status="$OSH_THEME_GIT_PROMPT_EQUAL_REMOTE"
|
||||
elif [[ $ahead -gt 0 ]] && [[ $behind -eq 0 ]]; then
|
||||
git_remote_status="$OSH_THEME_GIT_PROMPT_AHEAD_REMOTE"
|
||||
git_remote_status_detailed="$OSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$OSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))$_omb_prompt_reset_color"
|
||||
elif [[ $behind -gt 0 ]] && [[ $ahead -eq 0 ]]; then
|
||||
git_remote_status="$OSH_THEME_GIT_PROMPT_BEHIND_REMOTE"
|
||||
git_remote_status_detailed="$OSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$OSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))$_omb_prompt_reset_color"
|
||||
elif [[ $ahead -gt 0 ]] && [[ $behind -gt 0 ]]; then
|
||||
git_remote_status="$OSH_THEME_GIT_PROMPT_DIVERGED_REMOTE"
|
||||
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"
|
||||
fi
|
||||
|
||||
if [[ -n $OSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]]; then
|
||||
git_remote_status="$OSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$OSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX"
|
||||
fi
|
||||
|
||||
echo $git_remote_status
|
||||
if [[ $ahead -eq 0 ]] && [[ $behind -eq 0 ]]; then
|
||||
git_remote_status="$OSH_THEME_GIT_PROMPT_EQUAL_REMOTE"
|
||||
elif [[ $ahead -gt 0 ]] && [[ $behind -eq 0 ]]; then
|
||||
git_remote_status="$OSH_THEME_GIT_PROMPT_AHEAD_REMOTE"
|
||||
git_remote_status_detailed="$OSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$OSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))$_omb_prompt_reset_color"
|
||||
elif [[ $behind -gt 0 ]] && [[ $ahead -eq 0 ]]; then
|
||||
git_remote_status="$OSH_THEME_GIT_PROMPT_BEHIND_REMOTE"
|
||||
git_remote_status_detailed="$OSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$OSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))$_omb_prompt_reset_color"
|
||||
elif [[ $ahead -gt 0 ]] && [[ $behind -gt 0 ]]; then
|
||||
git_remote_status="$OSH_THEME_GIT_PROMPT_DIVERGED_REMOTE"
|
||||
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"
|
||||
fi
|
||||
|
||||
if [[ -n $OSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]]; then
|
||||
git_remote_status="$OSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$OSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX"
|
||||
fi
|
||||
|
||||
echo $git_remote_status
|
||||
fi
|
||||
}
|
||||
|
||||
# Outputs the name of the current branch
|
||||
|
Reference in New Issue
Block a user