jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/369496 )

Change subject: Not always is the last line empty
......................................................................


Not always is the last line empty

In some instances the last line in a commit message is not empty, but it would
always discard the last line which could cause actually invalid failures.

Change-Id: I9a775d491ba7409d3154c821973f7652fc6993ff
---
M commit_message_validator/__init__.py
1 file changed, 4 insertions(+), 2 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/commit_message_validator/__init__.py 
b/commit_message_validator/__init__.py
index fc3adea..7641560 100644
--- a/commit_message_validator/__init__.py
+++ b/commit_message_validator/__init__.py
@@ -266,8 +266,10 @@
 
     commit = check_output(
         ['git', 'log', '--format=%B', '--no-color', commit_id, '-n1'])
-    # last line is always an empty line
-    lines = commit.splitlines()[:-1]
+    lines = commit.splitlines()
+    # last line is sometimes an empty line
+    if len(lines) > 0 and not lines[-1]:
+        lines = lines[:-1]
 
     return check_message(lines)
 

-- 
To view, visit https://gerrit.wikimedia.org/r/369496
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9a775d491ba7409d3154c821973f7652fc6993ff
Gerrit-PatchSet: 2
Gerrit-Project: integration/commit-message-validator
Gerrit-Branch: master
Gerrit-Owner: XZise <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to