Skip to content

Commit

Permalink
20211116 Menu - master branch - quote variables in expression
Browse files Browse the repository at this point in the history
Function `check_git_updates()` does not quote variables used in
expressions. This leads to the errors:

```
./menu.sh: line 128: [: f6d9bbd2f702bf4dcb05e285423ba9a8a3f5390c: unary operator expected
./menu.sh: line 130: [: f6d9bbd2f702bf4dcb05e285423ba9a8a3f5390c: unary operator expected
```

Quotes added to expressions.
  • Loading branch information
Paraphraser committed Nov 16, 2021
1 parent 5ba4bb9 commit 94444af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions menu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ function check_git_updates()
REMOTE=$(git rev-parse "$UPSTREAM")
BASE=$(git merge-base @ "$UPSTREAM")

if [ $LOCAL = $REMOTE ]; then
if [ "$LOCAL" = "$REMOTE" ]; then
echo "Up-to-date"
elif [ $LOCAL = $BASE ]; then
elif [ "$LOCAL" = "$BASE" ]; then
echo "Need to pull"
elif [ $REMOTE = $BASE ]; then
elif [ "$REMOTE" = "$BASE" ]; then
echo "Need to push"
else
echo "Diverged"
Expand Down

0 comments on commit 94444af

Please sign in to comment.