Skip to content

Commit 44e51c4

Browse files
committed
Ignore commands in quotes
1 parent 86945db commit 44e51c4

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

homu/parse_issue_comment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def parse_issue_comment(username, body, sha, botname, hooks=[]):
158158
re.findall(r'\S+', re.sub(botname_regex, '', x))
159159
for x
160160
in body.splitlines()
161-
if '@' + botname in x)) # noqa
161+
if '@' + botname in x and not x.lstrip().startswith('>'))) # noqa
162162

163163
commands = []
164164

homu/tests/test_parse_issue_comment.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,3 +604,18 @@ def test_ignore_commands_after_bors_line():
604604
command = commands[0]
605605
assert command.action == 'approve'
606606
assert command.actor == 'jack'
607+
608+
609+
def test_in_quote():
610+
"""
611+
Test that a command in a quote (e.g. when replying by e-mail) doesn't
612+
trigger.
613+
"""
614+
615+
author = "jack"
616+
body = """
617+
> @bors r+
618+
"""
619+
commands = parse_issue_comment(author, body, commit, "bors")
620+
621+
assert len(commands) == 0

0 commit comments

Comments
 (0)