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