Forráskód Böngészése

bin/ircd: [commitbot] display commit message up to the first newline

Dastan-glitch 3 éve
szülő
commit
cb847faaec
1 módosított fájl, 3 hozzáadás és 5 törlés
  1. 3 5
      bin/ircd/script/bots/commitbot.py

+ 3 - 5
bin/ircd/script/bots/commitbot.py

@@ -95,14 +95,12 @@ def handle_forward_push(irc, data):
         print("==============================================")
         print("==============================================")
         irc.send("#dev", f"@{author} pushed {num_commits} to {branch}: {commit}")
         irc.send("#dev", f"@{author} pushed {num_commits} to {branch}: {commit}")
 
 
-MAX_COMMIT_LEN = 256
-
 def fmt_commit(cmt):
 def fmt_commit(cmt):
     hsh = cmt['id'][:10]
     hsh = cmt['id'][:10]
     # author = cmt['author']['name']
     # author = cmt['author']['name']
-    message = cmt['message']
-    message = message[:MAX_COMMIT_LEN] \
-            + ('..' if len(message) > MAX_COMMIT_LEN else '')
+    message = cmt['message'].split("\n")
+    message = message[0] \
+            + ('...' if len(message) > 1 else '')
 
 
     return '{}: {}'.format(hsh, message)
     return '{}: {}'.format(hsh, message)