Skip to content

Commit

Permalink
Prevent "binary operator expected" error
Browse files Browse the repository at this point in the history
`test -z` expects a string argument, otherwise, it raises the "binary
operator expected" error. The easiest way to convert something to a
string is to wrap it in quotes. That's why, in all place, the `test -z`
arguments are wrapped with quotes.
  • Loading branch information
extsoft committed Apr 15, 2020
1 parent 2812bfb commit 0a1642d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libexec/plugins/pipe
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ branch-pipe() {
# have to add new tests in `git-elegant-release-work.bats` if you want to
# check some specific cases.
local key="elegant.${COMMAND}-current-branch"
if test -z $(--repository-config --get ${key}); then
if test -z "$(--repository-config --get ${key})"; then
--repository-config ${key} $(git rev-parse --abbrev-ref HEAD)
fi

Expand Down
3 changes: 1 addition & 2 deletions libexec/plugins/state
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ is-there-upstream-for() {
}

are-there-remotes() {
local remotes=$(git remote)
if test -z ${remotes}; then
if test -z "$(git remote)"; then
return 1
fi
return 0
Expand Down

0 comments on commit 0a1642d

Please sign in to comment.