The Signed-off-by line should appear at the end of the commit message, and
immediately after any other lines of a similar format that may be used by
various tools - not necessarily just those that are whitelisted at present.
One example is the Change-Id line used by Gerrit to identify code reviews.
Users also frequently add their own informally-defined annotations in the
same format to the same block.

When deciding whether to add a newline between the last paragraph and the
signature, look for whether all lines in the last paragraph are in this
format rather than just searching for known sign-off types in the message.

Signed-off-by: Zane Bitter <[email protected]>
---
 stgit/utils.py |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/stgit/utils.py b/stgit/utils.py
index 0b66be3..8abbdf1 100644
--- a/stgit/utils.py
+++ b/stgit/utils.py
@@ -272,9 +272,9 @@ def add_sign_line(desc, sign_str, name, email):
     if sign_str in desc:
         return desc
     desc = desc.rstrip()
-    tags = ['\nCc:', '\nSigned-off-by:', '\nAcked-by:', '\nReported-by',
-            '\nTested-by:', '\nReviewed-by:', '\nSuggested-by:']
-    if not any(s in desc for s in tags):
+    preamble, lastblank, lastpara = desc.rpartition('\n\n')
+    is_signoff = re.compile(r'[A-Z][a-z]*(-[A-Za-z][a-z]*)*: ').match
+    if not (lastblank and all(is_signoff(l) for l in lastpara.split('\n'))):
         desc = desc + '\n'
     return '%s\n%s\n' % (desc, sign_str)
 


_______________________________________________
stgit-users mailing list
[email protected]
https://mail.gna.org/listinfo/stgit-users

Reply via email to