[ARVADOS-DEV] updated: 3e2d6818293a1269946423dc5e563ca1625ef84c

Git user git at public.curoverse.com
Mon Jan 8 21:39:17 EST 2018


Summary of changes:
 git/hooks/enforce-dco-signoff.rb | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

       via  3e2d6818293a1269946423dc5e563ca1625ef84c (commit)
      from  ede2bd8de3da671033441b5b8906caeb5d06ecd1 (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 3e2d6818293a1269946423dc5e563ca1625ef84c
Author: Ward Vandewege <ward at curoverse.com>
Date:   Mon Jan 8 21:38:48 2018 -0500

    Make the DCO signoff script less verbose, and make it handle new
    branches correctly.
    
    refs #11020
    
    Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <wvandewege at veritasgenetics.com>

diff --git a/git/hooks/enforce-dco-signoff.rb b/git/hooks/enforce-dco-signoff.rb
index 2ed8e61..c6245d2 100755
--- a/git/hooks/enforce-dco-signoff.rb
+++ b/git/hooks/enforce-dco-signoff.rb
@@ -13,7 +13,7 @@ $oldrev  = ARGV[1]
 $newrev  = ARGV[2]
 $user    = ENV['USER']
 
-puts "Enforcing DCO signoff... \n(#{$refname}) (#{$oldrev[0,6]}) (#{$newrev[0,6]})"
+puts "Enforcing DCO signoff: (#{$refname}) (#{$oldrev[0,6]}) (#{$newrev[0,6]})"
 
 $regex = /\[ref: (\d+)\]/
 
@@ -21,11 +21,26 @@ $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")
+  if ($newrev[0,6] ==  '000000')
+    # A branch is being deleted
+    all_revs    = [$oldrev]
+  elsif ($oldrev[0,6] ==  '000000')
+    if $refname != 'refs/heads/master'
+      # A new branch was pushed. Check all new commits in this branch.
+      all_revs  = `git log --pretty=format:%H master..#{$newrev}`.split("\n")
+    else
+      # When does this happen?
+      all_revs  = [$newrev]
+    end
+  else
+    all_revs    = `git rev-list --first-parent #{$oldrev}..#{$newrev}`.split("\n")
+  end
+
   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"

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list