[ARVADOS-DEV] updated: 7a5ba380aebe7b6fb04ee6fb719a299d035ab4f4
Git user
git at public.curoverse.com
Tue Jun 13 14:44:41 EDT 2017
Summary of changes:
git/hooks/enforce-dco-signoff.rb | 49 ++++++++++++++++++++++++++++++++++++++++
git/hooks/warn-dco-signoff.rb | 48 +++++++++++++++++++++++++++++++++++++++
2 files changed, 97 insertions(+)
create mode 100755 git/hooks/enforce-dco-signoff.rb
create mode 100755 git/hooks/warn-dco-signoff.rb
via 7a5ba380aebe7b6fb04ee6fb719a299d035ab4f4 (commit)
from 07723cdd4a47b39c96f8331e2f731cc6fc9eb307 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 7a5ba380aebe7b6fb04ee6fb719a299d035ab4f4
Author: Ward Vandewege <ward at curoverse.com>
Date: Tue Jun 13 14:41:59 2017 -0400
Add two git hooks to respectively enforce or warn about the DCO signoff
line in each git commit.
refs #2411
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curoverse.com>
diff --git a/git/hooks/enforce-dco-signoff.rb b/git/hooks/enforce-dco-signoff.rb
new file mode 100755
index 0000000..2ed8e61
--- /dev/null
+++ b/git/hooks/enforce-dco-signoff.rb
@@ -0,0 +1,49 @@
+#!/usr/bin/env ruby
+
+# This script can be installed as a git update hook.
+
+# It can also be installed as a gitolite 'hooklet' in the
+# hooks/common/update.secondary.d/ directory.
+
+# NOTE: this script runs under the same assumptions as the 'update' hook, so
+# the starting directory must be maintained and arguments must be passed on.
+
+$refname = ARGV[0]
+$oldrev = ARGV[1]
+$newrev = ARGV[2]
+$user = ENV['USER']
+
+puts "Enforcing DCO signoff... \n(#{$refname}) (#{$oldrev[0,6]}) (#{$newrev[0,6]})"
+
+$regex = /\[ref: (\d+)\]/
+
+$arvados_DCO = /Arvados-DCO-1.1-Signed-off-by:/
+
+# enforced DCO signoff in commit message
+def check_message_format
+ all_revs = `git rev-list --first-parent #{$oldrev}..#{$newrev}`.split("\n")
+ broken = false
+ all_revs.each do |rev|
+ message = `git cat-file commit #{rev} | sed '1,/^$/d' | grep -E "Arvados-DCO-1.1-Signed-off-by: .+ at .+\..+"`
+ puts message
+ if ! $arvados_DCO.match(message)
+ puts "\n[POLICY] Rejected commit: missing Arvados-DCO-1.1-Signed-off-by line"
+ puts "\n******************************************************************\n"
+ puts "\nOffending commit: #{rev}\n"
+ puts "\nOffending commit message:\n\n"
+ puts `git cat-file commit #{rev} | sed '1,/^$/d'`
+ puts "\n******************************************************************\n"
+ puts "\n\n"
+ puts "\nFor more information, see\n"
+ puts "\n https://dev.arvados.org/projects/arvados/wiki/Developer_Certificate_Of_Origin\n"
+ puts "\n\n"
+ broken = true
+ end
+ end
+
+ if broken
+ exit 1
+ end
+end
+
+check_message_format
diff --git a/git/hooks/warn-dco-signoff.rb b/git/hooks/warn-dco-signoff.rb
new file mode 100755
index 0000000..0a22912
--- /dev/null
+++ b/git/hooks/warn-dco-signoff.rb
@@ -0,0 +1,48 @@
+#!/usr/bin/env ruby
+
+# This script can be installed as a git update hook.
+
+# It can also be installed as a gitolite 'hooklet' in the
+# hooks/common/update.secondary.d/ directory.
+
+# NOTE: this script runs under the same assumptions as the 'update' hook, so
+# the starting directory must be maintained and arguments must be passed on.
+
+$refname = ARGV[0]
+$oldrev = ARGV[1]
+$newrev = ARGV[2]
+$user = ENV['USER']
+
+puts "Checking for DCO signoff... \n(#{$refname}) (#{$oldrev[0,6]}) (#{$newrev[0,6]})"
+
+$regex = /\[ref: (\d+)\]/
+
+$arvados_DCO = /Arvados-DCO-1.1-Signed-off-by:/
+
+# warn for missing DCO signoff in commit message
+def check_message_format
+ all_revs = `git rev-list --first-parent #{$oldrev}..#{$newrev}`.split("\n")
+ broken = false
+ all_revs.each do |rev|
+ message = `git cat-file commit #{rev} | sed '1,/^$/d' | grep -E "Arvados-DCO-1.1-Signed-off-by: .+ at .+\..+"`
+ puts message
+ if ! $arvados_DCO.match(message)
+ puts "\n[POLICY] WARNING: missing Arvados-DCO-1.1-Signed-off-by line"
+ puts "\n******************************************************************\n"
+ puts "\nOffending commit: #{rev}\n"
+ puts "\nOffending commit message:\n\n"
+ puts `git cat-file commit #{rev} | sed '1,/^$/d'`
+ puts "\n******************************************************************\n"
+ puts "\n\n"
+ puts "\nFor more information, see\n"
+ puts "\n https://dev.arvados.org/projects/arvados/wiki/Developer_Certificate_Of_Origin\n"
+ puts "\n\n"
+ end
+ end
+
+ if broken
+ exit 1
+ end
+end
+
+check_message_format
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list