Skip to content

Commit

Permalink
Add script to use as git pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-utkin committed Mar 23, 2024
1 parent 023b4c2 commit 06d7cc7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/git-pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -euo pipefail

LAST_UPGRADE="$(ls misc/sql/mysql-upgrade | sort -n -r | head -n 1)"
if ! [[ "$(< misc/sql/installed_db_version)" == "$LAST_UPGRADE" ]]; then
cat >&2 <<-EOF
Fix misc/sql/installed_db_version to be $LAST_UPGRADE
echo $LAST_UPGRADE > misc/sql/installed_db_version
git add misc/sql/installed_db_version
EOF
exit 1
fi

0 comments on commit 06d7cc7

Please sign in to comment.