File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,6 +112,8 @@ func TestExtractRefs(t *testing.T) {
112112 {"see #42 for context" , 1 },
113113 {"fix owner/repo#7" , 1 },
114114 {"https://github.com/owner/repo/issues/3" , 1 },
115+ {"see github.com/owner/repo/pull/4" , 1 },
116+ {"https://notgithub.com/owner/repo/issues/3" , 0 },
115117 {"nothing here" , 0 },
116118 }
117119
Original file line number Diff line number Diff line change 7878 // Matches owner/repo#123 or owner/repo #123 (issue or pull-request number).
7979 repoIssueRefPattern = regexp .MustCompile (`(?i)([a-z0-9](?:[a-z0-9-]*[a-z0-9])?)/([a-z0-9_.-]+)\s*#\s*(\d+)` )
8080 // Matches github.com/owner/repo/issues/123 or pull/123.
81- urlRefPattern = regexp .MustCompile (`(?i)github\.com/([a-z0-9](?:[a-z0-9-]*[a-z0-9])?)/([a-z0-9_.-]+)/(?:issues|pull)/(\d+)` )
81+ urlRefPattern = regexp .MustCompile (`(?i)(?:^|[^a-z0-9.-])(?:https?://)?(?:www\.)? github\.com/([a-z0-9](?:[a-z0-9-]*[a-z0-9])?)/([a-z0-9_.-]+)/(?:issues|pull)/(\d+)` )
8282 // Matches bare #123 in body or title, constrained to word boundaries.
8383 bareRefPattern = regexp .MustCompile (`(?:^|\s|\W)#\s*(\d+)(?:\b|$)` )
8484)
You can’t perform that action at this time.
0 commit comments