Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions scripts/pre-commit.hook
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,21 @@ for FILE in $C_FILES; do
fi
done

# Check syntax for changed shell scripts
SHELL_FILES=()
for file in "${FILES[@]}"; do
if [[ "$file" =~ ^scripts/common\.sh$ || "$file" =~ ^scripts/.*\.hook$ ]]; then
SHELL_FILES+=("$file")
fi
done
if [ "${#SHELL_FILES[@]}" -gt 0 ]; then
for file in "${SHELL_FILES[@]}"; do
if ! bash -n "$file"; then
throw "Syntax errors detected in $file." >&2
fi
done
fi

# Show insertion and deletion counts.
if [ "${#FILES[@]}" -gt 0 ]; then
echo "Following files were changed:"
Expand Down