Fix error where no parameters passed to a function

Also, update the names of a handful variables.
This commit is contained in:
xylous 2021-06-18 23:39:12 +03:00
parent 70cec22db5
commit 5b13b77fa3

View File

@ -17,8 +17,8 @@ function main() {
local remote="$REPLY"
[[ ! -z "$remote" ]] \
&& get_differences_between_remote_and_local \
&& local remote_local_diffs="$REPLY"
&& get_differences_between_remote_and_local "$branch" "$remote" \
&& local commit_diffs="$REPLY"
git_determine_color $modified $staged $deleted $untracked
local color="$REPLY"
@ -34,7 +34,7 @@ function main() {
local output="${color}"
output+="$branch"
output+="$local_remote_diffs"
output+="$commit_diffs"
output+="$modified"
output+="$staged"
output+="$deleted"
@ -105,11 +105,12 @@ function get_differences_between_remote_and_local()
local differences="$(git rev-list --left-right --count $local_branch...$remote_branch)"
local commits_ahead=$(echo -n "$differences" | awk '{print $1}')
local commits_behind=$(echo -n "$differences" | awk '{print $2}')
local ahead="" behind=""
(( $commits_ahead > 0 )) \
&& local ahead="$commits_ahead"
&& ahead="$commits_ahead"
(( $commits_behind > 0 )) \
&& local behind="$commits_behind"
&& behind="$commits_behind"
typeset -g REPLY="$ahead $behind"
return 0