File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use regex::Regex;
5
5
use crate :: { config:: IssueLinksConfig , github:: GithubCommit } ;
6
6
7
7
static LINKED_RE : LazyLock < Regex > =
8
- LazyLock :: new ( || Regex :: new ( r"( |^) ([a-zA-Z-_]+/[a-zA-Z-_]+)?(#[0-9]+)\b" ) . unwrap ( ) ) ;
8
+ LazyLock :: new ( || Regex :: new ( r"\B ([a-zA-Z-_]+/[a-zA-Z-_]+)?(#[0-9]+)\b" ) . unwrap ( ) ) ;
9
9
10
10
const MERGE_IGNORE_LIST : [ & str ; 2 ] = [ "Rollup merge of " , "Auto merge of " ] ;
11
11
@@ -76,7 +76,7 @@ fn test_mentions_in_commits() {
76
76
77
77
commits. push ( dummy_commit_from_body (
78
78
"891f0916a07c215ae8173f782251422f1fea6acb" ,
79
- "This is a body with a issue link rust-lang/rust#123." ,
79
+ "This is a body with a issue link ( rust-lang/rust#123) ." ,
80
80
) ) ;
81
81
82
82
assert_eq ! (
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ use crate::{
16
16
} ;
17
17
18
18
static LINKED_RE : LazyLock < Regex > =
19
- LazyLock :: new ( || Regex :: new ( r"(?P<start> |^) (?P<issue>#[0-9]+)\b" ) . unwrap ( ) ) ;
19
+ LazyLock :: new ( || Regex :: new ( r"\B (?P<issue>#[0-9]+)\b" ) . unwrap ( ) ) ;
20
20
21
21
pub ( super ) struct IssueLinksInput { }
22
22
@@ -63,7 +63,7 @@ pub(super) async fn handle_input(
63
63
}
64
64
65
65
fn fix_linked_issues < ' a > ( body : & ' a str , full_repo_name : & str ) -> Cow < ' a , str > {
66
- let replace_by = format ! ( "${{start}} {full_repo_name}${{issue}}" ) ;
66
+ let replace_by = format ! ( "{full_repo_name}${{issue}}" ) ;
67
67
parser:: replace_all_outside_ignore_blocks ( & LINKED_RE , body, replace_by)
68
68
}
69
69
@@ -115,6 +115,10 @@ fn edge_case_body() {
115
115
fix_linked_issues( "#132" , full_repo_name) ,
116
116
"rust-lang/rust#132"
117
117
) ;
118
+ assert_eq ! (
119
+ fix_linked_issues( "(#132)" , full_repo_name) ,
120
+ "(rust-lang/rust#132)"
121
+ ) ;
118
122
}
119
123
120
124
#[ test]
You can’t perform that action at this time.
0 commit comments