timescaledb/scripts/check_missing_gitignore_for_template_tests.sh
Fabrízio de Royes Mello a3d778f7a0 Add CI check for missing gitignore entries
Whenever we create a template sql file (*.sql.in) we should add the
respective .gitignore entry for the generated test files.

So added a CI check to check for missing gitignore entries for generated
test files.
2023-04-14 12:46:20 -03:00

19 lines
396 B
Bash
Executable File

#!/bin/bash
ERROR=0
for FILE in $(git ls-files | grep '\.sql\.in')
do
DIRNAME=$(dirname "${FILE}")
FILENAME=$(basename "${FILE}" .sql.in)
GITIGNORE=${DIRNAME}/.gitignore
if [ -f "${GITIGNORE}" ]; then
if ! grep -F --silent -e "${FILENAME}-*.sql" "${GITIGNORE}"; then
echo "Missing entry in ${GITIGNORE} for template file ${FILE}"
ERROR=1
fi
fi
done
exit ${ERROR}