pre-upload: permit s-o-b tags to follow Change-Id

The git commit -s flag will often append the signed-off-by tag.  Allow
that only to follow Change-Id to keep things simple for devs.

TEST=`./` passes

Change-Id: I0f47dc395b8ea453789a004f08339e6a342bb215
Reviewed-by: Julius Werner <>
Commit-Queue: Mike Frysinger <>
Tested-by: Mike Frysinger <>
diff --git a/ b/
index fa964fb..1d1ab0d 100755
--- a/
+++ b/
@@ -710,9 +710,14 @@
   CHANGE_ID_RE = r'\nChange-Id: I[a-f0-9]+\n'
   desc = _get_commit_desc(commit)
   m =, desc)
-  if not m or desc[m.end():].strip():
+  if not m:
     return HookFailure('Change-Id must be in last paragraph of description.')
+  # Allow s-o-b tags to follow it, but only those.
+  end = desc[m.end():].strip().splitlines()
+  if [x for x in end if not x.startswith('Signed-off-by: ')]:
+    return HookFailure('Only "Signed-off-by:" tags may follow the Change-Id.')
 def _check_commit_message_style(_project, commit):
   """Verify that the commit message matches our style.
diff --git a/ b/
index 815308f..00a098e 100755
--- a/
+++ b/
@@ -641,6 +641,10 @@
     """Reject Change-Id's that are not last."""
     self.assertMessageRejected('\nChange-Id: I1234\nbar\n')
+  def testSobTag(self):
+    """Permit s-o-b tags to follow the Change-Id."""
+    self.assertMessageAccepted('foo\n\nChange-Id: I1234\nSigned-off-by: Hi\n')
 class CheckCommitMessageStyle(CommitMessageTestCase):
   """Tests for _check_commit_message_style."""