From fc4129c67046ff5af81c04af43d930531ba1db5a Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Wed, 21 Feb 2018 13:23:07 -0300 Subject: [PATCH] Corrige check_migrations quando fora de um commit --- check_migrations.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/check_migrations.sh b/check_migrations.sh index 8e8f1c298..4c57dabb8 100755 --- a/check_migrations.sh +++ b/check_migrations.sh @@ -12,9 +12,12 @@ falha () exit 1 } -# deve haver alguma migration nova no commit -if ! git diff --cached --name-status | grep -q '^A.*/migrations/[[:digit:]]\{4\}_.*\.py$'; then - falha +# se há algum model no commit +if git diff --cached --name-status | grep -q '^M.*models\.py$'; then + # deve haver alguma migration nova no commit + if ! git diff --cached --name-status | grep -q '^A.*/migrations/[[:digit:]]\{4\}_.*\.py$'; then + falha + fi fi # a verificação de migrations pendentes deve passar