3 # This script can be installed as a git update hook.
5 # It can also be installed as a gitolite 'hooklet' in the
6 # hooks/common/update.secondary.d/ directory.
8 # NOTE: this script runs under the same assumptions as the 'update' hook, so
9 # the starting directory must be maintained and arguments must be passed on.
16 puts "Checking for DCO signoff... \n(#{$refname}) (#{$oldrev[0,6]}) (#{$newrev[0,6]})"
18 $regex = /\[ref: (\d+)\]/
20 $arvados_DCO = /Arvados-DCO-1.1-Signed-off-by:/
22 # warn for missing DCO signoff in commit message
23 def check_message_format
24 all_revs = `git rev-list --first-parent #{$oldrev}..#{$newrev}`.split("\n")
26 all_revs.each do |rev|
27 message = `git cat-file commit #{rev} | sed '1,/^$/d' | grep -E "Arvados-DCO-1.1-Signed-off-by: .+@.+\..+"`
29 if ! $arvados_DCO.match(message)
30 puts "\n[POLICY] WARNING: missing Arvados-DCO-1.1-Signed-off-by line"
31 puts "\n******************************************************************\n"
32 puts "\nOffending commit: #{rev}\n"
33 puts "\nOffending commit message:\n\n"
34 puts `git cat-file commit #{rev} | sed '1,/^$/d'`
35 puts "\n******************************************************************\n"
37 puts "\nFor more information, see\n"
38 puts "\n https://dev.arvados.org/projects/arvados/wiki/Developer_Certificate_Of_Origin\n"