Skip to content

Commit 499b745

Browse files
Remove hash from rollup id
1 parent 6828ef6 commit 499b745

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

site/src/request_handlers/github.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ fn parse_unrolled_build_message(commit_message: &str) -> Result<UnrolledBuildMes
295295
let first_line = commit_message.lines().next().unwrap_or("");
296296

297297
// The first line of the commit message will look like
298-
// `Unrolled build for #123 in rollup #123`
298+
// `Unrolled build for #123 in rollup 123`
299299
let words = first_line.split(" ").collect::<Vec<_>>();
300300
let ["Unrolled", "build", "for", member_pr_number, "in", "rollup", rollup_pr_number] =
301301
words[..]
@@ -313,10 +313,7 @@ fn parse_unrolled_build_message(commit_message: &str) -> Result<UnrolledBuildMes
313313
"Unexpected commit name `{first_line}`, could not parse member pr number. Is the commit an unrolled build?"
314314
));
315315
};
316-
let Some(rollup_pr_number) = rollup_pr_number
317-
.strip_prefix("#")
318-
.and_then(|num| num.parse::<u32>().ok())
319-
else {
316+
let Ok(rollup_pr_number) = rollup_pr_number.parse::<u32>() else {
320317
return Err(format!(
321318
"Unexpected commit name `{first_line}`, could not parse rollup pr number. Is the commit an unrolled build?"
322319
));
@@ -745,7 +742,7 @@ Otherwise LGTM."#),
745742

746743
#[test]
747744
fn pr_number_from_unrolled_build() {
748-
const EXAMPLE: &str = "Unrolled build for #157428 in rollup #1234
745+
const EXAMPLE: &str = "Unrolled build for #157428 in rollup 1234
749746
Rollup merge of #157428 - nia-e:allocator-refactor, r=clarfonthey
750747
751748
allocator: refactor for stabilisation
@@ -757,10 +754,10 @@ r? libs";
757754
@"Ok(UnrolledBuildMessage { member_pr_number: 157428, rollup_pr_number: 1234 })");
758755
insta::assert_compact_debug_snapshot!(parse_unrolled_build_message("Not a correct title"),
759756
@r#"Err("Unexpected commit name `Not a correct title`, could not parse commit title. Is the commit an unrolled build?")"#);
760-
insta::assert_compact_debug_snapshot!(parse_unrolled_build_message("Unrolled build for #123almost in rollup #1234"),
761-
@r#"Err("Unexpected commit name `Unrolled build for #123almost in rollup #1234`, could not parse member pr number. Is the commit an unrolled build?")"#);
762-
insta::assert_compact_debug_snapshot!(parse_unrolled_build_message("Unrolled build for #123 in rollup #1234almost"),
763-
@r#"Err("Unexpected commit name `Unrolled build for #123 in rollup #1234almost`, could not parse rollup pr number. Is the commit an unrolled build?")"#);
757+
insta::assert_compact_debug_snapshot!(parse_unrolled_build_message("Unrolled build for #123almost in rollup 1234"),
758+
@r#"Err("Unexpected commit name `Unrolled build for #123almost in rollup 1234`, could not parse member pr number. Is the commit an unrolled build?")"#);
759+
insta::assert_compact_debug_snapshot!(parse_unrolled_build_message("Unrolled build for #123 in rollup 1234almost"),
760+
@r#"Err("Unexpected commit name `Unrolled build for #123 in rollup 1234almost`, could not parse rollup pr number. Is the commit an unrolled build?")"#);
764761
insta::assert_compact_debug_snapshot!(parse_unrolled_build_message("Unrolled build for #123"),
765762
@r#"Err("Unexpected commit name `Unrolled build for #123`, could not parse commit title. Is the commit an unrolled build?")"#);
766763
}

0 commit comments

Comments
 (0)