Skip to content

Commit 51f5fda

Browse files
committed
fix #175 - only match first Bugzilla reference
- to be consistent with GH's Bugzilla integration
1 parent 7885c29 commit 51f5fda

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

source/dlangbot/bugzilla.d

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,15 @@ auto matchIssueRefs(string message)
2626

2727
// see https://github.com/github/github-services/blob/2e886f407696261bd5adfc99b16d36d5e7b50241/lib/services/bugzilla.rb#L155
2828
enum issueRE = ctRegex!(`((close|fix|address)e?(s|d)? )?(ticket|bug|tracker item|issue)s?:? *([\d ,\+&#and]+)`, "i");
29-
return message.matchAll(issueRE).map!matchToRefs.joiner;
29+
return matchToRefs(message.matchFirst(issueRE));
3030
}
3131

3232
unittest
3333
{
3434
assert(equal(matchIssueRefs("fix issue 16319 and fix std.traits.isInnerClass"), [IssueRef(16319, true)]));
35+
assert(equal(matchIssueRefs("Fixes issues 17494, 17505, 17506"), [IssueRef(17494, true), IssueRef(17505, true), IssueRef(17506, true)]));
36+
// only first match considered, see #175
37+
assert(equal(matchIssueRefs("Fixes Issues 1234 and 2345\nblabla\nFixes Issue 3456"), [IssueRef(1234, true), IssueRef(2345, true)]));
3538
}
3639

3740
struct IssueRef { int id; bool fixed; }

0 commit comments

Comments
 (0)