From 1285baa3c095962265dc07b515ac9c0f7e75b959 Mon Sep 17 00:00:00 2001 From: Michael Allen Date: Wed, 16 Sep 2015 14:24:29 +0100 Subject: Merge zsh and bash remote commit diff --- radar-base.sh | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/radar-base.sh b/radar-base.sh index 12cab90..747cb5e 100755 --- a/radar-base.sh +++ b/radar-base.sh @@ -483,7 +483,7 @@ zsh_color_local_commits() { printf $PRINT_F_OPTION "$local_commits" } -bash_color_remote_commits() { +color_remote_commits() { local green_ahead_arrow="${COLOR_REMOTE_AHEAD}←$RESET_COLOR_REMOTE" local red_behind_arrow="${COLOR_REMOTE_BEHIND}→$RESET_COLOR_REMOTE" local yellow_diverged_arrow="${COLOR_REMOTE_DIVERGED}⇄$RESET_COLOR_REMOTE" @@ -507,29 +507,14 @@ bash_color_remote_commits() { printf $PRINT_F_OPTION "$remote" } -zsh_color_remote_commits() { - local green_ahead_arrow="${COLOR_REMOTE_AHEAD}←$RESET_COLOR_REMOTE" - local red_behind_arrow="${COLOR_REMOTE_BEHIND}→$RESET_COLOR_REMOTE" - local yellow_diverged_arrow="${COLOR_REMOTE_DIVERGED}⇄$RESET_COLOR_REMOTE" - local not_upstream="${COLOR_REMOTE_NOT_UPSTREAM}⚡$RESET_COLOR_REMOTE" - - if remote_branch="$(remote_branch_name)"; then - remote_ahead="$(remote_ahead_of_master "$remote_branch")" - remote_behind="$(remote_behind_of_master "$remote_branch")" - - if [[ "$remote_behind" -gt "0" && "$remote_ahead" -gt "0" ]]; then - remote="$MASTER_SYMBOL $remote_behind $yellow_diverged_arrow $remote_ahead " - elif [[ "$remote_ahead" -gt "0" ]]; then - remote="$MASTER_SYMBOL $green_ahead_arrow $remote_ahead " - elif [[ "$remote_behind" -gt "0" ]]; then - remote="$MASTER_SYMBOL $remote_behind $red_behind_arrow " - fi - else - remote="upstream $not_upstream " - fi +bash_color_remote_commits() { + color_remote_commits +} - printf $PRINT_F_OPTION "$remote" +zsh_color_remote_commits() { + color_remote_commits } + show_remote_status() { if [[ $@ == *$NO_REMOTE_STATUS* ]]; then return 1 # don't show the git remote status -- cgit v1.2.3