syncthing/check-contrib.sh

49 lines
1.2 KiB
Bash
Raw Normal View History

2014-08-25 12:55:08 +00:00
#!/bin/bash
2014-11-18 14:13:19 +00:00
missing-authors() {
2014-12-08 13:04:49 +00:00
for email in $(git log --format=%ae HEAD | sort | uniq) ; do
2014-11-16 20:13:20 +00:00
grep -q "$email" AUTHORS || echo $email
2014-08-25 12:55:08 +00:00
done
}
no-docs-typos() {
# Commits that are known to not change code
grep -v 63bd0136fb40a91efaa279cb4b4159d82e8e6904 |\
grep -v 4e2feb6fbc791bb8a2daf0ab8efb10775d66343e |\
2014-08-25 12:55:08 +00:00
grep -v f2459ef3319b2f060dbcdacd0c35a1788a94b8bd |\
grep -v b61f418bf2d1f7d5a9d7088a20a2a448e5e66801 |\
grep -v f0621207e3953711f9ab86d99724f1d0faac45b1 |\
2014-12-08 14:41:08 +00:00
grep -v f1120d7aa936c0658429edef0037792520b46334 |\
grep -v a9339d0627fff439879d157c75077f02c9fac61b |\
grep -v 254c63763a3ad42fd82259f1767db526cff94a14
2014-08-25 12:55:08 +00:00
}
2014-11-18 14:13:19 +00:00
print-missing-authors() {
for email in $(missing-authors) ; do
2014-09-04 06:31:38 +00:00
git log --author="$email" --format="%H %ae %s" | no-docs-typos
done
}
print-missing-copyright() {
find . -name \*.go | xargs egrep -L 'Copyright \(C\)|automatically generated' | grep -v Godeps | grep -v internal/auto/
2014-09-04 06:31:38 +00:00
}
authors=$(print-missing-authors)
if [[ ! -z $authors ]] ; then
2014-12-08 14:41:08 +00:00
echo '***'
echo Author emails not in AUTHORS:
echo $authors
2014-12-08 14:41:08 +00:00
echo '***'
exit 1
fi
copy=$(print-missing-copyright)
if [[ ! -z $copy ]] ; then
2014-12-08 13:04:49 +00:00
echo ***
echo Files missing copyright notice:
echo $copy
2014-12-08 13:04:49 +00:00
echo ***
exit 1
fi
2014-08-25 12:55:08 +00:00