Automatic closing issue reference can be wrong with internal and external tracker enabled
When you have both internal and external issue trackers enabled, the reference #123 only refers to the internal issue 123.
When you create a merge request starting with a number then a hyphen, we look up that issue, and append Closes #123 to the description.
So this can happen:
- Create a project with an external and internal issue tracker.
- Create an internal issue with IID 1.
- Create an external issue with ID 9 (or whatever).
- Create a branch to fix the issue in 3,
9-fix-issue. - When we create an MR from that branch, we will correctly match 9 as an external issue, but append
Closes #9to the MR description - which is wrong, because that syntax should only refer to the internal tracker.
As Project#get_issue only returns an ExternalIssue in this case if it couldn't find an internal issue, I think the risk is quite low. The most common cases are:
- A gap in the issue numbering on the internal tracker. This can be due to a deleted issue, or perhaps a confidential issue that the MR author can't see.
- An external tracker issue with the same ID as an internal issue. This is just confusing anyway.
- An external tracker issue with an ID just above the highest internal issue. This is probably the most likely.