mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-08-08 15:56:43 +08:00
添加 github.com/pion/dtls 代码
This commit is contained in:
64
dtls-2.0.9/.github/lint-commit-message.sh
vendored
Normal file
64
dtls-2.0.9/.github/lint-commit-message.sh
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# DO NOT EDIT THIS FILE
|
||||
#
|
||||
# It is automatically copied from https://github.com/pion/.goassets repository.
|
||||
#
|
||||
# If you want to update the shared CI config, send a PR to
|
||||
# https://github.com/pion/.goassets instead of this repository.
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
display_commit_message_error() {
|
||||
cat << EndOfMessage
|
||||
$1
|
||||
|
||||
-------------------------------------------------
|
||||
The preceding commit message is invalid
|
||||
it failed '$2' of the following checks
|
||||
|
||||
* Separate subject from body with a blank line
|
||||
* Limit the subject line to 50 characters
|
||||
* Capitalize the subject line
|
||||
* Do not end the subject line with a period
|
||||
* Wrap the body at 72 characters
|
||||
EndOfMessage
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
lint_commit_message() {
|
||||
if [[ "$(echo "$1" | awk 'NR == 2 {print $1;}' | wc -c)" -ne 1 ]]; then
|
||||
display_commit_message_error "$1" 'Separate subject from body with a blank line'
|
||||
fi
|
||||
|
||||
if [[ "$(echo "$1" | head -n1 | awk '{print length}')" -gt 50 ]]; then
|
||||
display_commit_message_error "$1" 'Limit the subject line to 50 characters'
|
||||
fi
|
||||
|
||||
if [[ ! $1 =~ ^[A-Z] ]]; then
|
||||
display_commit_message_error "$1" 'Capitalize the subject line'
|
||||
fi
|
||||
|
||||
if [[ "$(echo "$1" | awk 'NR == 1 {print substr($0,length($0),1)}')" == "." ]]; then
|
||||
display_commit_message_error "$1" 'Do not end the subject line with a period'
|
||||
fi
|
||||
|
||||
if [[ "$(echo "$1" | awk '{print length}' | sort -nr | head -1)" -gt 72 ]]; then
|
||||
display_commit_message_error "$1" 'Wrap the body at 72 characters'
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$#" -eq 1 ]; then
|
||||
if [ ! -f "$1" ]; then
|
||||
echo "$0 was passed one argument, but was not a valid file"
|
||||
exit 1
|
||||
fi
|
||||
lint_commit_message "$(sed -n '/# Please enter the commit message for your changes. Lines starting/q;p' "$1")"
|
||||
else
|
||||
for commit in $(git rev-list --no-merges origin/master..); do
|
||||
lint_commit_message "$(git log --format="%B" -n 1 $commit)"
|
||||
done
|
||||
fi
|
Reference in New Issue
Block a user