Skip to content

Improves branch name autolink matching logic #4238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2025

Conversation

axosoft-ramint
Copy link
Contributor

@axosoft-ramint axosoft-ramint commented Apr 16, 2025

Refactors the branch name autolink matching logic to improve accuracy and reduce false positives.

  • Introduces new regex matching rules/heuristics for branch name matching based on prefix and issue number patterns:
  1. If a ref is prefixed, match to a 2+ digit number with the prefix followed by a connector (/|-|_|.) or end-of-string and take the first match encountered..
  2. If ref is not prefixed, match to a 2+ digit number in the pattern of (feature|feat|fix|bug|bugfix|hotfix|issue|ticket)(/|-|_|#|/#|-#|_#)<num> followed by a connector (/|-|_|.) or end-of-string and take the first match.
  3. If ref is not prefixed and no matches from rule 2, match to a 3+ digit number that is either the full branch name, or is preceded or followed by at least two non-slash (/), non-numeric characters. Note: this is to rule out numbers that are full sections like <num>/..., .../<num>/..., or .../<num> and to rule out date-formats like <num.<num2> or <num>-<num2>.
  • Filters remote autolinks for branch names to only include non-dynamic autolinks of type 'branch'.
  • Fixes issue where integration autolinks were incorrectly collected for branch autolinking.
  • Adds underscored prefixes to Jira intergration autolinks like GLVSC_123 as valid prefix matches for branch names only
  • Sorts refsets so that issue integrations are checked first for matches.
  • Limits branch autolink matches to 1 maximum per branch name.
  • Updates unit tests and adds comments specifying the reasoning for matches and failures

Closes #3894

@axosoft-ramint axosoft-ramint requested a review from eamodio April 16, 2025 22:12
@axosoft-ramint axosoft-ramint force-pushed the 3894-improve-issue-matching-with-branch-names branch from 5dede38 to 3fc84c1 Compare April 21, 2025 14:59
@d13 d13 mentioned this pull request Apr 21, 2025
7 tasks
@axosoft-ramint axosoft-ramint requested a review from d13 April 21, 2025 20:50
@axosoft-ramint axosoft-ramint force-pushed the 3894-improve-issue-matching-with-branch-names branch from 3fc84c1 to 1ebec4a Compare April 23, 2025 14:57
@d13 d13 mentioned this pull request Apr 23, 2025
7 tasks
Refactors the branch name autolink matching logic to improve accuracy and reduce false positives.

- Introduces multiple regexes for branch name matching based on prefix and issue number patterns.
- Updates test
- Filters remote autolinks for branch names to only include non-dynamic autolinks of type 'branch'.
- Fixes issue where integration autolinks were incorrectly collected for branch autolinking.
- Sorts refsets so that issue integrations are checked first for matches.
- Limits branch autolink matches to 1 maximum per branch name.
@axosoft-ramint axosoft-ramint force-pushed the 3894-improve-issue-matching-with-branch-names branch from 1ebec4a to 0bb9f0b Compare April 24, 2025 15:58
Copy link
Member

@d13 d13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@axosoft-ramint axosoft-ramint merged commit 4525d7e into main Apr 24, 2025
3 checks passed
@axosoft-ramint axosoft-ramint deleted the 3894-improve-issue-matching-with-branch-names branch April 24, 2025 16:32
saeedzaha pushed a commit to saeedzaha/vscode-gitlens that referenced this pull request Apr 28, 2025
…itkraken#4238)

Refactors the branch name autolink matching logic to improve accuracy and reduce false positives.

- Introduces multiple regexes for branch name matching based on prefix and issue number patterns.
- Updates test
- Filters remote autolinks for branch names to only include non-dynamic autolinks of type 'branch'.
- Fixes issue where integration autolinks were incorrectly collected for branch autolinking.
- Sorts refsets so that issue integrations are checked first for matches.
- Limits branch autolink matches to 1 maximum per branch name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve issue matching with branch names
2 participants