From 55fa93c2cdcecfb96c4de689976dca3dd4ce259b Mon Sep 17 00:00:00 2001 From: Michael Allen Date: Mon, 10 Aug 2015 19:52:50 +0100 Subject: Remove unnecessary is_repo check from commit functions --- git-base.sh | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/git-base.sh b/git-base.sh index 23c3fd8..3cf24b5 100755 --- a/git-base.sh +++ b/git-base.sh @@ -382,19 +382,16 @@ bash_color_local_commits() { local yellow_diverged_arrow="\033[1;33m⇵\033[0m" local local_commits="" - if is_repo; then - - if remote_branch="$(remote_branch_name)"; then - local_ahead="$(commits_ahead_of_remote "$remote_branch")" - local_behind="$(commits_behind_of_remote "$remote_branch")" - - if [[ "$local_behind" -gt "0" && "$local_ahead" -gt "0" ]]; then - local_commits="$separator$local_behind$yellow_diverged_arrow$local_ahead" - elif [[ "$local_behind" -gt "0" ]]; then - local_commits="$separator$local_behind$red_behind_arrow" - elif [[ "$local_ahead" -gt "0" ]]; then - local_commits="$separator$local_ahead$green_ahead_arrow" - fi + if remote_branch="$(remote_branch_name)"; then + local_ahead="$(commits_ahead_of_remote "$remote_branch")" + local_behind="$(commits_behind_of_remote "$remote_branch")" + + if [[ "$local_behind" -gt "0" && "$local_ahead" -gt "0" ]]; then + local_commits="$separator$local_behind$yellow_diverged_arrow$local_ahead" + elif [[ "$local_behind" -gt "0" ]]; then + local_commits="$separator$local_behind$red_behind_arrow" + elif [[ "$local_ahead" -gt "0" ]]; then + local_commits="$separator$local_ahead$green_ahead_arrow" fi fi echo "$local_commits" @@ -408,19 +405,16 @@ zsh_color_local_commits() { local diverged_arrow="%{$fg_bold[yellow]%}⇵%{$reset_color%}" local local_commits="" - if is_repo; then - - if remote_branch="$(remote_branch_name)"; then - local_ahead="$(commits_ahead_of_remote "$remote_branch")" - local_behind="$(commits_behind_of_remote "$remote_branch")" - - 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 + if remote_branch="$(remote_branch_name)"; then + local_ahead="$(commits_ahead_of_remote "$remote_branch")" + local_behind="$(commits_behind_of_remote "$remote_branch")" + + 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 echo "$local_commits" -- cgit v1.2.3