forked from AgoraIO/API-Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost-commit
More file actions
executable file
·27 lines (25 loc) · 1.13 KB
/
post-commit
File metadata and controls
executable file
·27 lines (25 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# Check if required hooks are installed
if [ ! -f ".git/hooks/commit-msg" ] || [ ! -x ".git/hooks/commit-msg" ]; then
echo "============================================================"
echo "Note: Git hooks for checking Chinese characters in commit messages are not installed."
echo "Please run the following commands to install:"
echo ""
echo " 1. Install pre-commit:"
echo " pip install pre-commit"
echo ""
echo " 2. Install pre-commit hook:"
echo " pre-commit install"
echo ""
echo " 3. Install commit-msg hook:"
echo " pre-commit install --hook-type commit-msg"
echo " cp .git-hooks/check-commit-message.sh .git/hooks/commit-msg"
echo " chmod +x .git/hooks/commit-msg"
echo ""
echo "These hooks will help detect sensitive information leaks and Chinese characters in commit messages."
echo "============================================================"
fi
# Ensure the hook itself is executable
if [ -f ".git-hooks/check-commit-message.sh" ] && [ ! -x ".git-hooks/check-commit-message.sh" ]; then
chmod +x .git-hooks/check-commit-message.sh
fi