summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Allen <michael@michaelallen.io>2015-09-16 14:26:27 +0100
committerMichael Allen <michael@michaelallen.io>2015-09-16 14:26:27 +0100
commitd4ce9372c1f5ee82ac019d5a3c84f8af64cb0e4f (patch)
tree2febe3408d771df2a361a0f054b47be5c9618a0e
parent1285baa3c095962265dc07b515ac9c0f7e75b959 (diff)
downloadgit-sonar-d4ce9372c1f5ee82ac019d5a3c84f8af64cb0e4f.tar.gz
git-sonar-d4ce9372c1f5ee82ac019d5a3c84f8af64cb0e4f.zip
Merge zsh and bash local commit render func
-rwxr-xr-xradar-base.sh27
1 files changed, 6 insertions, 21 deletions
diff --git a/radar-base.sh b/radar-base.sh
index 747cb5e..fb5fa90 100755
--- a/radar-base.sh
+++ b/radar-base.sh
@@ -437,7 +437,7 @@ zsh_color_changes_status() {
printf $PRINT_F_OPTION "$changes"
}
-bash_color_local_commits() {
+color_local_commits() {
local separator="${1:- }"
local green_ahead_arrow="${COLOR_LOCAL_AHEAD}↑$RESET_COLOR_LOCAL"
@@ -460,27 +460,12 @@ bash_color_local_commits() {
printf $PRINT_F_OPTION "$local_commits"
}
-zsh_color_local_commits() {
- local separator="${1:- }"
-
- local ahead_arrow="${COLOR_LOCAL_AHEAD}↑$RESET_COLOR_LOCAL"
- local behind_arrow="${COLOR_LOCAL_BEHIND}↓$RESET_COLOR_LOCAL"
- local diverged_arrow="${COLOR_LOCAL_DIVERGED}⇵$RESET_COLOR_LOCAL"
-
- local local_commits=""
- if remote_branch="$(remote_branch_name)"; then
- local_ahead="$(commits_ahead_of_remote "$remote_branch")"
- local_behind="$(commits_behind_of_remote "$remote_branch")"
+bash_color_local_commits() {
+ color_local_commits
+}
- if [[ "$local_behind" -gt "0" && "$local_ahead" -gt "0" ]]; then
- local_commits="$separator$local_behind$diverged_arrow$local_ahead"
- elif [[ "$local_behind" -gt "0" ]]; then
- local_commits="$separator$local_behind$behind_arrow"
- elif [[ "$local_ahead" -gt "0" ]]; then
- local_commits="$separator$local_ahead$ahead_arrow"
- fi
- fi
- printf $PRINT_F_OPTION "$local_commits"
+zsh_color_local_commits() {
+ color_local_commits
}
color_remote_commits() {