Fix pre-push hook used by husky
The pre-push hook uses sh but contained syntax that is only supported by
bash. `=` in sh should be used instead of `==` to check for string
equality. Before this change, we were getting the following error when
pushing to any branch:
```
git push
husky > pre-push (node v10.22.1)
./bin/pre-push.sh: 7: [: refs/heads/master: unexpected operator
```
This error didn't block the push, but meant that the message asking
developers to confirm if they wanted to push to master was never
displayed. This problem was introduced in commit
8c25557bf5
added in PR #27028.
This commit is contained in:
parent
4dd4230931
commit
6e61398c83
|
@ -4,8 +4,8 @@ PROTECTED_BRANCH="master"
|
|||
REMOTE_REF=$(echo "$HUSKY_GIT_STDIN" | cut -d " " -f 3)
|
||||
|
||||
if [ -n "$REMOTE_REF" ]; then
|
||||
if [ "refs/heads/${PROTECTED_BRANCH}" == "$REMOTE_REF" ]; then
|
||||
if [ "$TERM" == "dumb" ]; then
|
||||
if [ "refs/heads/${PROTECTED_BRANCH}" = "$REMOTE_REF" ]; then
|
||||
if [ "$TERM" = "dumb" ]; then
|
||||
>&2 echo "Sorry, you are unable to push to master using a GUI client! Please use git CLI."
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue