Prefer -n over ! -z, suggested by shellcheck

This commit is contained in:
Lin Jen-Shin 2021-10-29 00:59:58 +08:00
parent ec7850832f
commit 8209d6d433

View file

@ -1,6 +1,6 @@
#!/bin/sh
if [ ! -z "$(git diff --name-only -- db/structure.sql)" ]; then
if [ -n "$(git diff --name-only -- db/structure.sql)" ]; then
printf "Schema changes are not cleanly committed to db/structure.sql\n"
printf "The diff is as follows:\n"
diff=$(git diff -p --binary -- db/structure.sql)
@ -10,7 +10,7 @@ else
printf "Schema changes are correctly applied to db/structure.sql\n"
fi
if [ ! -z "$(git add -A -n db/schema_migrations)" ]; then
if [ -n "$(git add -A -n db/schema_migrations)" ]; then
printf "Schema version files have not been committed to the repository:\n"
printf "The following files should be committed:\n"
diff=$(git add -A -n db/schema_migrations)