mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
test: more accurate checking of commit title
This commit is contained in:
parent
efcf03f0b1
commit
555028f3d1
16
test
16
test
@ -149,18 +149,22 @@ function fmt_tests {
|
|||||||
|
|
||||||
echo "Checking commit titles..."
|
echo "Checking commit titles..."
|
||||||
git log master..HEAD --oneline | while read l; do
|
git log master..HEAD --oneline | while read l; do
|
||||||
pfx=`echo "$l" | cut -f2 -d' '`
|
commitMsg=`echo "$l" | cut -f2- -d' '`
|
||||||
if [ "$pfx" == "Merge" ]; then
|
if [[ "$commitMsg" == Merge* ]]; then
|
||||||
# ignore "Merge pull" commits
|
# ignore "Merge pull" commits
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
if [ "$pfx" == "Revert" ]; then
|
if [[ "$commitMsg" == Revert* ]]; then
|
||||||
# ignore revert commits
|
# ignore revert commits
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
if ! [[ "$pfx" =~ :$ ]]; then
|
|
||||||
echo "$pfx"...
|
pkgPrefix=`echo "$commitMsg" | cut -f1 -d':'`
|
||||||
echo "Expected commit title format '<package>: <description>'"
|
spaceCommas=`echo "$commitMsg" | sed 's/ /\n/g' | grep -c ',$' || echo 0`
|
||||||
|
commaSpaces=`echo "$commitMsg" | sed 's/,/\n/g' | grep -c '^ ' || echo 0`
|
||||||
|
if [[ `echo $commitMsg | grep -c ":..*"` == 0 || "$commitMsg" == "$pkgPrefix" || "$spaceCommas" != "$commaSpaces" ]]; then
|
||||||
|
echo "$l"...
|
||||||
|
echo "Expected commit title format '<package>{\", \"<package>}: <description>'"
|
||||||
echo "Got: $l"
|
echo "Got: $l"
|
||||||
exit 255
|
exit 255
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user