diff options
author | Michael Allen <michael@michaelallen.io> | 2015-08-10 19:52:50 +0100 |
---|---|---|
committer | Michael Allen <michael@michaelallen.io> | 2015-08-10 19:52:50 +0100 |
commit | 55fa93c2cdcecfb96c4de689976dca3dd4ce259b (patch) | |
tree | 5885dc45e09741d6458e85c3ba16b6a01268d466 /git-base.sh | |
parent | b27e644f6359b6a04d1be7d6a9f679496ed28349 (diff) | |
download | git-sonar-55fa93c2cdcecfb96c4de689976dca3dd4ce259b.tar.gz git-sonar-55fa93c2cdcecfb96c4de689976dca3dd4ce259b.zip |
Remove unnecessary is_repo check from commit functions
Diffstat (limited to '')
-rwxr-xr-x | git-base.sh | 46 |
1 files 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" |