From f0c68d6d2cf4225891b22bb53238a44ffa9944cd Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Wed, 25 Nov 2026 00:59:42 +0100 Subject: [PATCH] nightly: read the built commit only from a lower-case version gate / gate (ubuntu-24.04) failed channel::tests::the_commit_is_read_back_only_from_a_nightly_version: `commit_for` used `is_ascii_hexdigit`, which also accepts A-F, so `...gABCDEF012345` read back as a commit although the producer's version pattern is lower-case. The check now takes digits and a-f only, as the nightly version pattern already requires. --- crates/ui-egui/src/channel.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/channel.rs b/crates/ui-egui/src/channel.rs index 61eb4e047..4a19d72df 100644 --- a/crates/ui-egui/src/channel.rs +++ b/crates/ui-egui/src/channel.rs @@ -92,10 +92,13 @@ pub fn version() -> &'static str { } /// The commit a nightly was built from, read back from its version (`…g`), if any. +/// +/// The producer writes the sha in lower case (the version pattern every nightly job enforces), so an +/// upper-case one is a malformed version rather than a commit: nothing is read back for it. pub fn commit_for(version: &str) -> Option<&str> { let (_, suffix) = version.split_once("-nightly.")?; let (_, sha) = suffix.rsplit_once(".g")?; - (sha.len() == 12 && sha.bytes().all(|b| b.is_ascii_hexdigit())).then_some(sha) + (sha.len() == 12 && sha.bytes().all(|b| matches!(b, b'0'..=b'9' | b'a'..=b'f'))).then_some(sha) } pub fn commit() -> Option<&'static str> {