pre-upload: reject Signed-off-by tags by default

These make sense in a few specific repos, but not the majority.
Start rejecting them so people stop adding theme everywhere.

BUG=None
TEST=upload still works

Change-Id: Ie62b68d4804e5cc7540e1a2050d47be5a70d5537
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/repohooks/+/1917972
Reviewed-by: Michael Mortensen <mmortensen@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/pre-upload.py b/pre-upload.py
index 4ccdc3a..2917f17 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -1594,6 +1594,18 @@
   return None
 
 
+def _check_change_has_no_signoff_field(_project, commit):
+  """Verify 'Signed-off-by:' field does not exist in the commit message."""
+  if commit == PRE_SUBMIT:
+    return None
+  SIGNOFF_RE = r'\nSigned-off-by: \S+'
+
+  if re.search(SIGNOFF_RE, _get_commit_desc(commit)):
+    msg = 'This checkout does not use Signed-off-by: tags.  Delete them.'
+    return HookFailure(msg)
+  return None
+
+
 def _check_cq_ini_well_formed(_project, commit):
   """Check that any modified COMMIT-QUEUE.ini files are well formed."""
   pattern = '.*' + constants.CQ_CONFIG_FILENAME
@@ -1904,6 +1916,8 @@
   enabled_hooks = set(hooks[x] for x in enable_flags)
   disabled_hooks = set(hooks[x] for x in disable_flags)
 
+  if _check_change_has_signoff_field not in enabled_hooks:
+    enabled_hooks.add(_check_change_has_no_signoff_field)
   if _check_change_has_branch_field not in enabled_hooks:
     enabled_hooks.add(_check_change_has_no_branch_field)